Site logo

Archived topic

Unwanted Featured Image showing on Custom Post Types (GPP beta 1.4-rc.1)

20 replies · Started by Zach on July 28, 2017

Viewing posts 1–15 of 21

I have a custom post type and regular posts/pages, and I'd like to avoid showing the featured image above their single posts.

Single Post Header Location is set to "hide" in the customizer. That works for posts/pages, but the featured image is still showing on CPT single posts. Is this something related to the beta Page Header system? (I have no Page Header defined in the admin, and no mappings in the Global Locations, but if I make an empty Page Header and apply it to my CPT as a location, the featured image still shows.)

I can work around it by using the "disable elements" metabox on each Artwork post but that seems like a hack. Am I missing something? (Note: I've only been using CPTs for a few days before switching to GPP beta, so I'm not 100% sure that this behavior is related to the beta.)

The Single Post Page Header option set to hide should remove it from all post types.

Can you link me to the post?

Thanks for getting back to me. The snippet didn't work (tweaked for my CPT name "artwork").

Here's a link that shows the problem:
https://www.zachpoff.com/site/artwork/pondstation/

and another where the featured image was successfully removed via “disable elements” metabox:
https://www.zachpoff.com/site/artwork/witnesses-trikaya/

FYI: These CPT posts used to be pages, but I used the Post Type Switcher plugin to switch them to the Artwork CPT. They seem to work fine in all other respects so I doubt it's related.

Done. (via pre-sales form)
And to thicken the plot, I just noticed that single Pages are showing the errant featured images too. This site is in transition so there are currently Posts, Pages, & CPTs that all began as Pages long ago.

In summary:
Posts ("DIY Resources") no featured image (as per customizer)
Pages ("Software"): featured images showing
CPT's ("Artwork") featured images showing

FYI... All theme-specific customizations are in a child theme. All theme-agnostic stuff (registering CPT) is in a plugin.

Basically what's happening here is the Single Post Page Header option is meant for the "post" post type only, so setting it to hide is only going to work on single blog posts.

Obviously not ideal - those Page Header location options are quite old and need to be re-worked.

Did this work "correctly" prior to 1.4?

In GPP 1.5, we'll be focusing on blog options, including single featured image options (same as the current featured image options). This will allow us to change the location and remove featured images from single posts.

For now, try this:

add_action( 'wp', 'tu_remove_single_cpt_page_header' );
function tu_remove_single_cpt_page_header() {
    if ( 'artwork' == get_post_type() ) {
        remove_action( 'generate_after_header','generate_page_header' );
    }
}

That snippet worked for the CPTs. However the featured images are still showing on Pages, strangely, they're within the post content area instead of the page header. example:

https://www.zachpoff.com/site/software/brightsign-video-sync-scripts/

Any ideas about that?

I made the CPT just a few days before switching to GPP beta, but I'm pretty sure they were displaying normally in the release version. I'm willing to downgrade to check if you give me some guidance (if it won't mess up the db). This site is months away from being public so I'm willing to experiment!

Looking forward to 1.5's blog options. As mentioned in another thread I'd really appreciate an option to put text over images in the blog index, like a stripped-down alternative to fancy grid plugins. (Not thrilled with hover effects and corny animations, but I love the clean look of a grid of images with titles and optional metadata overlaid) example:
http://the7.io/main/portfolio/portfolio-grid/3-portfolio-grid/

I just made an adjustment - any chance I can link you to the version with this change so we can test it out before I release another release candidate?

Absolutely.

Haven't forgotten about you - just cleaning some things up to make sure I have it working 100%.

Will let you know :)

I just released RC.2 which should fix this issue.

Let me know :)

Removed the snippet you posted earlier and upgraded to RC.2.

It works for my Custom Post Types (archive and single posts):
CPT archive: https://www.zachpoff.com/site/artwork/
CPT single: https://www.zachpoff.com/site/artwork/pondstation/
(note that the yellow banner is created using the new Page Header system with all Global Locations selected.)

BUT...

CPT taxonomy archive pages ignore the new Page Header system completely:
https://www.zachpoff.com/site/artwork/type/installation/

I noticed another issue relating to custom image sizes in the Page Header, but I'll continue that on this thread since it's only visible in situations where the new Page Header system is turned off.

This archived topic is closed to new replies.