Fix Task 3 path (page.php is at theme root) and indentation (use tabs)
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
- `wp-content/themes/community-works-collaborative/acf/group_60bfb84ae973c.json` — Add `hero_image` and `hero_vector` image fields. Bump `modified` timestamp.
|
- `wp-content/themes/community-works-collaborative/acf/group_60bfb84ae973c.json` — Add `hero_image` and `hero_vector` image fields. Bump `modified` timestamp.
|
||||||
- `wp-content/themes/community-works-collaborative/styles/blocks/index.css` — Add `@import './page-hero.css';`.
|
- `wp-content/themes/community-works-collaborative/styles/blocks/index.css` — Add `@import './page-hero.css';`.
|
||||||
- `wp-content/themes/community-works-collaborative/views/partials/page-hero.php` — Read the two new fields. Render `hero_image` and `hero_vector` as absolutely-positioned media layers. Add `.page-hero`, `.page-hero__media`, `.page-hero__vector`, `.page-hero__content` classes. Stop rendering the in-hero `intro` paragraph.
|
- `wp-content/themes/community-works-collaborative/views/partials/page-hero.php` — Read the two new fields. Render `hero_image` and `hero_vector` as absolutely-positioned media layers. Add `.page-hero`, `.page-hero__media`, `.page-hero__vector`, `.page-hero__content` classes. Stop rendering the in-hero `intro` paragraph.
|
||||||
- `wp-content/themes/community-works-collaborative/views/page.php` — Render the page-intro partial between the hero and `the_content` when the `intro` field is non-empty.
|
- `wp-content/themes/community-works-collaborative/page.php` — Render the page-intro partial between the hero and `the_content` when the `intro` field is non-empty. (Note: `page.php` is at the theme root, not `views/page.php` — WordPress convention. Use tabs to match the existing file and the WordPress coding standard enforced by phpcs.)
|
||||||
|
|
||||||
### Touched for verification only (no content changes)
|
### Touched for verification only (no content changes)
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ git commit -m "Add page-intro partial for centered narrow intro section"
|
|||||||
## Task 3: Wire the intro partial into page.php
|
## Task 3: Wire the intro partial into page.php
|
||||||
|
|
||||||
**Files:**
|
**Files:**
|
||||||
- Modify: `wp-content/themes/community-works-collaborative/views/page.php`
|
- Modify: `wp-content/themes/community-works-collaborative/page.php` (at the theme root, not `views/page.php` — WordPress convention)
|
||||||
|
|
||||||
**Interfaces:**
|
**Interfaces:**
|
||||||
- Consumes: The `page-intro` partial (Task 2). Reads `get_field( 'intro' )`.
|
- Consumes: The `page-intro` partial (Task 2). Reads `get_field( 'intro' )`.
|
||||||
@@ -219,11 +219,11 @@ git commit -m "Add page-intro partial for centered narrow intro section"
|
|||||||
|
|
||||||
- [ ] **Step 1: Read the current page.php**
|
- [ ] **Step 1: Read the current page.php**
|
||||||
|
|
||||||
Read `views/page.php` to confirm current contents.
|
Read `page.php` to confirm current contents. Note the indentation style — the existing file uses **tabs** (WordPress coding standard). The brief's code block uses 4-space indentation as a transcription convention; convert to tabs to match the surrounding code.
|
||||||
|
|
||||||
- [ ] **Step 2: Replace page.php with the new version**
|
- [ ] **Step 2: Replace page.php with the new version**
|
||||||
|
|
||||||
Write `views/page.php` to match:
|
Write `page.php` to match (using **tabs** for indentation):
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
@@ -242,34 +242,34 @@ $clsEntry = '';
|
|||||||
|
|
||||||
// Determine classes based on sidebar presence
|
// Determine classes based on sidebar presence
|
||||||
if ( hasSidebar() ) {
|
if ( hasSidebar() ) {
|
||||||
$classes = 'container grid grid-cols-1 lg:grid-cols-4 gap-8 xl:gap-16 my-section mx-auto';
|
$classes = 'container grid grid-cols-1 lg:grid-cols-4 gap-8 xl:gap-16 my-section mx-auto';
|
||||||
$clsEntry = 'lg:col-span-3';
|
$clsEntry = 'lg:col-span-3';
|
||||||
} else {
|
} else {
|
||||||
$classes = 'container my-section lg:my-0 mx-auto';
|
$classes = 'container my-section lg:my-0 mx-auto';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article class="<?php echo esc_attr( $classes ); ?>">
|
<article class="<?php echo esc_attr( $classes ); ?>">
|
||||||
<div class="entry-content <?php echo esc_attr( $clsEntry ); ?>">
|
<div class="entry-content <?php echo esc_attr( $clsEntry ); ?>">
|
||||||
<?php
|
<?php
|
||||||
// Centered intro section beneath the hero (rendered by header.php).
|
// Centered intro section beneath the hero (rendered by header.php).
|
||||||
if ( get_field( 'intro' ) ) {
|
if ( get_field( 'intro' ) ) {
|
||||||
get_template_part( 'views/partials/page-intro' );
|
get_template_part( 'views/partials/page-intro' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page body content
|
// Page body content
|
||||||
if ( have_posts() ) {
|
if ( have_posts() ) {
|
||||||
while ( have_posts() ) {
|
while ( have_posts() ) {
|
||||||
the_post();
|
the_post();
|
||||||
the_content();
|
the_content();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ( hasSidebar() ) : ?>
|
<?php if ( hasSidebar() ) : ?>
|
||||||
<?php get_sidebar( 'page' ); ?>
|
<?php get_sidebar( 'page' ); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<?php get_footer(); ?>
|
<?php get_footer(); ?>
|
||||||
@@ -277,13 +277,13 @@ if ( hasSidebar() ) {
|
|||||||
|
|
||||||
- [ ] **Step 3: Lint the modified file**
|
- [ ] **Step 3: Lint the modified file**
|
||||||
|
|
||||||
Run: `composer lint -- views/page.php`
|
Run: `vendor/bin/phpcs page.php`
|
||||||
Expected: no errors.
|
Expected: 1/1 clean. The pre-existing CRLF EOL errors in unrelated files (per Task 2's report) are out of scope; don't run `composer lint` (full project) for this task.
|
||||||
|
|
||||||
- [ ] **Step 4: Commit**
|
- [ ] **Step 4: Commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add views/page.php
|
git add page.php
|
||||||
git commit -m "Render page-intro partial between hero and body in page.php"
|
git commit -m "Render page-intro partial between hero and body in page.php"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user