- This topic has 30 replies, 8 voices, and was last updated 6 years, 9 months ago by
Leo.
-
AuthorPosts
-
March 11, 2017 at 7:32 am #290134
SCIP
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
March 11, 2017 at 10:29 am #290181Tom
Lead DeveloperLead DeveloperIs the post type called finalist or finalists?
Try this:
is_singular( 'finalists' )June 20, 2017 at 11:33 pm #336661pz
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?
June 21, 2017 at 12:10 am #336675Tom
Lead DeveloperLead DeveloperIt looks like the CPT slug is:
firmaJune 21, 2017 at 8:51 am #336924pz
You were right, but the snippet still doesn’t work.
June 21, 2017 at 1:42 pm #337093Tom
Lead DeveloperLead DeveloperI 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 ); } }June 21, 2017 at 11:24 pm #337238pz
June 22, 2017 at 12:05 am #337247Tom
Lead DeveloperLead DeveloperThat’s very strange..
You could always use CSS:
.single-firma .page-header-image-single { display: none; }June 22, 2017 at 1:30 am #337283pz
Yes, CSS worked. Thank you again.
June 22, 2017 at 9:37 am #337457Tom
Lead DeveloperLead DeveloperNo problem 🙂
September 4, 2017 at 5:44 pm #379177Vee
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!September 4, 2017 at 6:10 pm #379185Vee
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. 🙂September 4, 2017 at 11:44 pm #379268Tom
Lead DeveloperLead DeveloperI just adjusted the PHP above – can you try it now?: https://generatepress.com/forums/topic/remove-featured-image-on-custom-post-type/#post-337093
September 5, 2017 at 5:48 pm #379891Vee
hm. no, I’m afraid not.
here is a live site you can see-
example pageI’m entering this is the code snippets plug in you’ve recommended.. let me know if theres any other information I can give?
September 6, 2017 at 12:02 am #380007Tom
Lead DeveloperLead DeveloperCan you try setting the Single Post Header Header to “Above Content Area”?
-
AuthorPosts
- You must be logged in to reply to this topic.