Skip to content

Comments

feat: add featured image caption block#415

Open
chickenn00dle wants to merge 6 commits intotrunkfrom
feat/add-featured-image-caption-block
Open

feat: add featured image caption block#415
chickenn00dle wants to merge 6 commits intotrunkfrom
feat/add-featured-image-caption-block

Conversation

@chickenn00dle
Copy link

@chickenn00dle chickenn00dle commented Feb 18, 2026

All Submissions:

Changes proposed in this Pull Request:

Closes https://linear.app/a8c/issue/NPPD-1187/captioncredit-block-for-featured-images

This PR adds a featured image caption block to the block theme and adds the block to every template which contains a featured image.

Screenshot 2026-02-18 at 15 38 36

How to test the changes in this Pull Request:

  1. Go to any post and add a featured image or featured image block to the post.
  2. Add the featured image caption block to the page
  3. Save and view the post on the frontend. Confirm the featured image caption appears as expected
  4. Back in the editor select the featured image caption block and add custom text
  5. Save. View the featured image meta by selecting 'Replace' and confirm the caption did not change.
  6. View the post on the frontend. Confirm the featured image caption appears as expected
  7. Go back to the editor and remove the featured image.
  8. Confirm the featured image caption block displays placeholder text asking you to add a featured image.
  9. Save and view the post on the frontend. Confirm the featured image caption block is not present.
  10. In the editor, add the query loop block and add the featured image and featured image caption blocks and save.
  11. Verify the query loop displays the featured image captions correctly in the frontend
  12. Via the site editor, go to any post template and confirm the featured image caption block is present.
  13. Make changes and save. Verify the changes reflect correctly on the front-end

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@chickenn00dle chickenn00dle marked this pull request as ready for review February 18, 2026 21:29
@chickenn00dle chickenn00dle requested a review from a team as a code owner February 18, 2026 21:29
Copilot AI review requested due to automatic review settings February 18, 2026 21:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new custom block for displaying featured image captions with optional media credit information. The block integrates with the Newspack Image Credits plugin to automatically display caption and credit metadata, while also allowing users to override with custom caption text.

Changes:

  • Added a new newspack-block-theme/featured-image-caption block with editor UI and server-side rendering
  • Integrated the block into all post and archive templates that display featured images
  • Implemented support for automatic caption/credit display from media metadata with custom override capability

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
includes/blocks/featured-image-caption/class-featured-image-caption.php PHP class for block registration and server-side rendering
includes/blocks/featured-image-caption/block.json Block metadata and configuration
includes/blocks/featured-image-caption/edit.js React component for block editor UI
includes/blocks/featured-image-caption/editor.js Block registration entry point
includes/blocks/featured-image-caption/style.scss Styles for placeholder text in editor
includes/blocks/index.php Added require statement to load new block class
src/scss/blocks/_blocks.scss Added import for block styles
templates/single/*.html Added featured-image-caption block to all single post templates
templates/archive.html Added featured-image-caption block to archive template
templates/author.html Added featured-image-caption block to author template
templates/home.html Added featured-image-caption block to home template
templates/search.html Added featured-image-caption block to search template

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant