- This topic has 30 replies, 8 voices, and was last updated 4 years, 9 months ago by Leo.
-
AuthorPosts
-
September 9, 2017 at 3:00 pm #382484Vee
I tried moving the single post header to “above content area” and other locations too just to see… no change.
and just removing the single post header ( made with BB Themer) didn’t affect the feature image appearance either.
Thanks for your help with this.September 10, 2017 at 12:19 am #382601TomLead DeveloperLead DeveloperI assume you changed this line to match your custom post type name?
if ( is_singular( 'firma' ) )
November 26, 2017 at 6:33 pm #435142RobertI can confirm that this doesn’t appear to be working but it may be because it looks like to removes the page header instead of the actual feature image. When I edit the single content file, removing this: do_action( ‘generate_before_content’); removes the feature image as desired, however I’m not sure if that is the best way to do that. I don’t want to remove something essential. Main goal here is to simply remove the feature him.
add_action( 'wp', 'tu_remove_featured_images', 15 ); function tu_remove_featured_images() { if ( is_singular( 'tutorial' ) ){ remove_action( 'generate_after_header','generate_page_header', 10 ); } }
I’m trying to remove the feature image from the custom post type called “tutorial”.
Any ideas?
November 26, 2017 at 10:25 pm #435293TomLead DeveloperLead DeveloperHi there,
Do you have the Blog add-on activated?
Let me know π
November 27, 2017 at 2:07 pm #436276RobertYes I do. Just to be clear I don’t want to remove the feature image for all blog posts, just the custom post type. I tried poking around the files to see what the customizer does to remove the featured image (as I see that is an option) for single posts and I was able to find a filter just not sure how to hook into this in order to try to remove the feature image:
$image_html = apply_filters( 'generate_single_featured_image_html', $image_html ); echo apply_filters( 'generate_single_featured_image_output', sprintf( '<div class="featured-image %2$s"> %1$s </div>', $image_html, implode( ' ', $classes ) ), $image_html ); }
November 27, 2017 at 3:27 pm #436354RobertI managed to remove it like so.
function my_post_image_html( $html, $post_id, $post_image_id ) { if(is_singular('tutorial')) { return ''; } else return $html; } add_filter( 'generate_single_featured_image_output', 'my_post_image_html', 10, 3 );
Any issues doing it this way?
November 27, 2017 at 7:10 pm #436516TomLead DeveloperLead DeveloperThat’s the perfect way to do it. Very nice! π
November 28, 2017 at 8:33 am #437059RobertThanks Tom! π
January 26, 2018 at 7:37 pm #480886DanIf you never need a featured image on a custom post type, then just make sure when the CPT is defined it does not support thumbnails.
January 26, 2018 at 11:38 pm #480925TomLead DeveloperLead DeveloperThat’s definitely the best option π
July 1, 2019 at 2:17 am #945790ThierryHello,
i re-open this post because i have the same problem and the snippets don’t work. If it’s possible i don’t want use the css, have you a idea ?
July 1, 2019 at 8:56 am #946221TomLead DeveloperLead DeveloperHi there,
Just to confirm, what exactly are you wanting to do?
July 1, 2019 at 9:46 am #946272ThierryHi Tom,
I don’t want displaying the image featured on my custom post type single page.
July 1, 2019 at 6:01 pm #946566LeoStaffCustomer SupportGive this a shot:
add_filter( 'option_generate_blog_settings', 'lh_cpt_single' ); function lh_cpt_single( $options ) { if ( is_singular( 'CPT NAME' ) ) { $options['single_post_image'] = false; } return $options; }
Let me know π
July 3, 2019 at 3:17 am #947734ThierryTht’as work ! thanks leo π
-
AuthorPosts
- You must be logged in to reply to this topic.