Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4339 closed defect (bug) (fixed)

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

Reported by: ryelle's profile ryelle Owned by: coreymckrill's profile 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 5 years ago.
Screen Shot 2019-03-26 at 4.43.45 PM.png (86.5 KB) - added by ryelle 5 years ago.

Download all attachments as: .zip

Change History (9)

5 years ago

#1 @ryelle
5 years 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
5 years 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
5 years 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.

5 years ago

#5 @coreymckrill
5 years 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

#6 @vedjain
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 8748:

WC Campsite17: Content option support for featured image in custom CPT.

This patch adds featured image support to Custom Post Types as well like sponsors. This uses JetPack's content option feature so that displaying featured image is customizable.

For back compatibility in previous sites, this would disabled by default, and will enabled only for new WordCamp sites. Old WordCamp sites can enable this by going to Customizer->ContentOptions.

Fixes #3645 #4339
Props ryelle, vedjain

#7 @vedjain
5 years ago

In 8762:

WC Campsite17: Adds featured image support with feature flag.

In an earlier patch r8748, Jetpack's content options was used to add featured image support. For backwards compatibility, this was disabled by default using a feature flag on all existing sites.

This caused an issue because content options were removing featured images on *all* renders including in blocks and shortcode. Therefore r8748 was eventually reverted in r8753.

This patch adds featured image support natively instead of using Jetpack Content Support so as to not disable images in blocks and shortcodes. This also means that if any exisiting camp needs featured image supported, they would have to request to have the backwards compatibility flag removed for them.

See #3645 #4339

Note: See TracTickets for help on using tickets.