Fix Task 3 path (page.php is at theme root) and indentation (use tabs)

This commit is contained in:
Keith Solomon
2026-07-01 10:19:21 -05:00
parent a8affd474d
commit d389fd7bc8
@@ -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/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/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)
@@ -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
**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:**
- 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**
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**
Write `views/page.php` to match:
Write `page.php` to match (using **tabs** for indentation):
```php
<?php
@@ -242,34 +242,34 @@ $clsEntry = '';
// Determine classes based on sidebar presence
if ( hasSidebar() ) {
$classes = 'container grid grid-cols-1 lg:grid-cols-4 gap-8 xl:gap-16 my-section mx-auto';
$clsEntry = 'lg:col-span-3';
$classes = 'container grid grid-cols-1 lg:grid-cols-4 gap-8 xl:gap-16 my-section mx-auto';
$clsEntry = 'lg:col-span-3';
} 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 ); ?>">
<div class="entry-content <?php echo esc_attr( $clsEntry ); ?>">
<?php
// Centered intro section beneath the hero (rendered by header.php).
if ( get_field( 'intro' ) ) {
get_template_part( 'views/partials/page-intro' );
}
<div class="entry-content <?php echo esc_attr( $clsEntry ); ?>">
<?php
// Centered intro section beneath the hero (rendered by header.php).
if ( get_field( 'intro' ) ) {
get_template_part( 'views/partials/page-intro' );
}
// Page body content
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_content();
}
}
?>
</div>
// Page body content
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_content();
}
}
?>
</div>
<?php if ( hasSidebar() ) : ?>
<?php get_sidebar( 'page' ); ?>
<?php endif; ?>
<?php if ( hasSidebar() ) : ?>
<?php get_sidebar( 'page' ); ?>
<?php endif; ?>
</article>
<?php get_footer(); ?>
@@ -277,13 +277,13 @@ if ( hasSidebar() ) {
- [ ] **Step 3: Lint the modified file**
Run: `composer lint -- views/page.php`
Expected: no errors.
Run: `vendor/bin/phpcs page.php`
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**
```bash
git add views/page.php
git add page.php
git commit -m "Render page-intro partial between hero and body in page.php"
```