WordPress.org

Making WordPress.org

Opened 13 months ago

Closed 7 weeks ago

Last modified 7 weeks ago

#3645 closed defect (fixed)

Sponsors single page template should display featured image

Reported by: tar.gz Owned by: vedjain
Milestone: Priority: normal
Component: WordCamp Site & Plugins Keywords:
Cc:

Description

The current CampSite 2017 theme (v.1.0.0) isn't displaying featured images for posts or pages.

There is one place where that's an issue: the "Sponsors" custom post type (CPT), added through the wc-post-types plugin.

This CPT expects the sponsors logo to be added as the Featured Image. In this way, it can be displayed via the sponsors shortcode.

This works fine whenever the shortcode is used – in a widget area, or a main sponsors listing produced with the shortcode.

Example of sponsors listing created by the shortcode: https://2018.europe.wordcamp.org/sponsors/

However, the actual "custom post type page" of the sponsor isn't rendered with the shortcode, but with the single post template : template-parts/content.php.

That explains why the logo doesn't show up here.

Example of single sponsor page, created by theme template, where to logo is missing:
https://2018.europe.wordcamp.org/sponsor/bluehost/

This becomes a problem when a WordCamp site admin wants to link to those single sponsor pages – it's an option in the shortcode, "link to the sponsor’s post".

Workarounds

In that case, the site admin will probably add a second logo inside the post content, in order to make it show up on the single page.

This will result in duplicate logos appearing where the shortcode is used. This is currently being solved with CSS workaround, that hide the duplicate logos on specific places.

Proposed solution

The optimal way would be to add a template for the "wcb_sponsor" CPT, which would show the Featured Image.

Attachments (2)

Screen Shot 2018-05-31 at 10.46.36 AM.png (118.5 KB) - added by melchoyce 13 months ago.
Screenshot 2019-05-08 at 10.05.26 PM.png (17.5 KB) - added by vedjain 7 weeks ago.
Screen shot for Content Options

Download all attachments as: .zip

Change History (10)

#1 @iandunn
13 months ago

Hmm, what does everyone think of showing the featured image on all content types (if it exists)?

#2 @tar.gz
13 months ago

Some more info on my hands-on experience with the CampSite theme: our main (only?) use for the featured image, apart from the sponsors pages, is to provide an image for sharing pages on social media (call for speakers, call for volunteers, etc). Indeed, the Open Graph functionality, added by Jetpack, uses the featured image.

So we have added featured images that are specially tailored towards social media, have the WordCamp logo and date embedded, etc. It's not really a problem that they don't appear in the layout, as they are selected with regards to social media much more than for the website look-and-feel.

The website having a big visual header that is consistent on every page, a featured image would maybe add too much visual noise.

On the other hand, considering that every WordCamp team may have a different view on displaying featured images, it's pretty easy to hide them with custom CSS, but it's not possible to display if the theme doesn't make them available.

#3 @ryelle
13 months ago

My team has also run into this -- we'd also like the sponsor's featured image to be shown on the sponsor page.

Hmm, what does everyone think of showing the featured image on all content types (if it exists)?

Having the featured image showing on sponsors makes sense with the way the sponsor content is provided to us -- the global sponsor logos are featured images, not images inset into the content. I've also added images to speakers when they don't have gravatars, that could also be a featured image? But for posts…

So we have added featured images that are specially tailored towards social media

We've also done this on posts, so I would probably hide the image on posts if it was turned on.

#4 @melchoyce
13 months ago

Could we adapt Automattic's "Content Options" theme feature here? It allows you to show/hide specific elements. I'll attach a screenshot to show what I mean.

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


2 months ago

#6 @vedjain
7 weeks ago

  • Owner set to vedjain
  • Resolution set to fixed
  • Status changed from new 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

@vedjain
7 weeks ago

Screen shot for Content Options

#7 @vedjain
7 weeks ago

Just to clarify on the above patch, this adds Jetpack's option to enable featured images on all post types, not just the Custom Post Types. This will be disabled by default on all existing sites and enabled only on new sites for backwards compatibility. For existing sites, it can be enabled by going to Customizer->Content Options.

This fix was suggested in #4339.

See screenshot https://meta.trac.wordpress.org/attachment/ticket/3645/Screenshot%202019-05-08%20at%2010.05.26%20PM.png

#8 @vedjain
7 weeks 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.