Making WordPress.org

Opened 3 weeks ago

Last modified 10 hours ago

#4339 assigned defect

Add support for Jetpack's Content Options to enable featured images in CampSite theme

Reported by: ryelle Owned by: coreymckrill
Milestone: Priority: normal
Component: WordCamp Site & Plugins Keywords: has-patch commit


Currently, featured images are enabled but not shown on any posts or page on sites using the CampSite 2017 base theme. This is related to #3645, but more general- I'd like to see featured content on posts & pages (for WordCamp US).

On #3645, @melchoyce suggested we use Jetpack's Content Options to allow turning on/off the featured image. We can do that, and default the images to "off". This will prevent current sites from suddenly having featured images, but will let sites that want to use them to turn them on.

Attachments (2)

4339.diff (3.5 KB) - added by ryelle 3 weeks ago.
Screen Shot 2019-03-26 at 4.43.45 PM.png (86.5 KB) - added by ryelle 3 weeks ago.

Download all attachments as: .zip

Change History (7)

3 weeks ago

#1 @ryelle
3 weeks ago

  • Keywords has-patch added

4339.diff adds the Content Options support for posts, pages, and home/archives, and adds the featured image to each template part.

The ( ! is_single() || is_singular( 'post' ) ) condition in template-parts/content.php is there so that the featured image is not displayed on custom post types, since the Content Options don't have a way to control those specifically (it's grouped in with the "Display on single posts").

If you apply the patch, you should see no difference on existing sites, but now there's a Content Options section in the customizer. Turning on each checkbox should display featured images on the respective condition.

#2 @iandunn
3 weeks ago

  • Keywords reporter-feedback added
  • Status changed from new to assigned

+1 for the general idea.

Rather than adding an extra UI for this, I wonder if it'd make sense to just add the images (for new sites) without any conditions? It seems like if a post author explicitly adds a featured image, then they'd expect it to show up. What's the use case for adding a featured image but not showing it?

For older sites, we can set a feature flag to avoid adding the images retroactively (see wcorg_skip_feature().

#3 @ryelle
3 weeks ago

What's the use case for adding a featured image but not showing it?

This came up in #3645 – some camps use the featured image for a social media card, since Jetpack adds it as the og:image. I think leaving the option to turn it on/off is still useful for that case.

This ticket was mentioned in Slack in #meta-wordcamp by ryelle. View the logs.

10 hours ago

#5 @coreymckrill
10 hours ago

  • Keywords commit added; reporter-feedback removed
  • Owner set to coreymckrill

Summary of Slack discussion:

  • Use wcorg_skip_feature() to change the default values of the content options
  • Separately, use wcorg_skip_feature() to ensure that only new sites show featured images on CPT single templates
  • Need to test and see if the content option to "Enable on posts" applies to CPTs as well
  • The patch for this would also fix #3645
Note: See TracTickets for help on using tickets.