Archived topic
Remove featured image on custom post type
30 replies · Started by SCIP on March 11, 2017
I have a custom post type called finalists, which has a featured image (which I want to display elsewhere).
I have tried this code to remove the featured image but can't get it to work. Do you have any ideas.
add_action( 'after_setup_theme','generate_remove_single_featured_images' );
function generate_remove_single_featured_images()
{
if ( is_singular( $post_types = 'finalist' ) ){
remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);
remove_action('generate_before_content','generate_page_header_single', 10);
remove_action('generate_after_entry_header','generate_page_header_single_below_title', 10);
remove_action('generate_after_header','generate_page_header_single_above', 10);
}
}
Many thanks
Mark
Is the post type called finalist or finalists?
Try this: is_singular( 'finalists' )
I have a similar probem. My custom post type is called "firmy".
https://autoinformator.pl/firma/abl-aik-drazkiewicz/
As You can see in the link above on a custom post type page the featured image displays on top (before the content). I'd like to disable it globally
I tried doing it using the snippet below, but it didn't work.
add_action( 'after_setup_theme','generate_remove_single_featured_images' );
function generate_remove_single_featured_images()
{
if ( is_singular( 'firmy' ) ){
remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);
remove_action('generate_before_content','generate_page_header_single', 10);
remove_action('generate_after_entry_header','generate_page_header_single_below_title', 10);
remove_action('generate_after_header','generate_page_header_single_above', 10);
}
}
Any ideas?
It looks like the CPT slug is: firma
You were right, but the snippet still doesn't work.
I think you're looking for this:
add_action( 'wp', 'tu_remove_featured_images', 15 );
function tu_remove_featured_images() {
if ( is_singular( 'firma' ) ){
remove_action( 'generate_after_header','generate_page_header', 10 );
}
}
That's very strange..
You could always use CSS:
.single-firma .page-header-image-single {
display: none;
}
Yes, CSS worked. Thank you again.
No problem :)
Hi!
I am having the same problem would prefer to not use the CSS method, if possible. I have tried both, or rather all three of the above options, with my own CPT (trying both 'artist' and 'artists'), and they don't work for me either...
I am using a child theme, and wondering that is somehow related to the problem?
I'm on a pw protected staging site, and could provide log-in for troubleshooting.
I do however want to use the featured images in the post, just not through the GP theme... so i'm not sure how to disable it in the theme, but still make it usable in the post?
Using Beaver Builder plugin + themer.
thank you!
also, the content title is appearing, which is undesired.
For now I am disabling these with the Disable Elements module, which is super, but would like to make creating a new CPT as foolproof as possible for the user. :)
I just adjusted the PHP above - can you try it now?: https://generatepress.com/forums/topic/remove-featured-image-on-custom-post-type/#post-337093
hm. no, I'm afraid not.
here is a live site you can see-
example page
I'm entering this is the code snippets plug in you've recommended.. let me know if theres any other information I can give?
Can you try setting the Single Post Header Header to "Above Content Area"?