[Resolved] Remove featured image on custom post type

Home Forums Support [Resolved] Remove featured image on custom post type

Home Forums Support Remove featured image on custom post type

Viewing 15 posts - 1 through 15 (of 31 total)
  • Author
    Posts
  • #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

    #290181
    Tom
    Lead Developer
    Lead Developer

    Is the post type called finalist or finalists?

    Try this: is_singular( 'finalists' )

    #336661
    pz

    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?

    #336675
    Tom
    Lead Developer
    Lead Developer

    It looks like the CPT slug is: firma

    #336924
    pz

    You were right, but the snippet still doesn’t work.

    #337093
    Tom
    Lead Developer
    Lead Developer

    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 );
        }
    }
    #337238
    pz

    Unfortunately this solution also doesn’t work. I tried the snippet mentioned here and a few other combinations and still nothing. The featured image is visible (example). Any other ideas?

    #337247
    Tom
    Lead Developer
    Lead Developer

    That’s very strange..

    You could always use CSS:

    .single-firma .page-header-image-single {
        display: none;
    }
    #337283
    pz

    Yes, CSS worked. Thank you again.

    #337457
    Tom
    Lead Developer
    Lead Developer

    No problem ๐Ÿ™‚

    #379177
    Vee

    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!

    #379185
    Vee

    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. ๐Ÿ™‚

    #379268
    Tom
    Lead Developer
    Lead Developer
    #379891
    Vee

    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?

    #380007
    Tom
    Lead Developer
    Lead Developer

    Can you try setting the Single Post Header Header to “Above Content Area”?

Viewing 15 posts - 1 through 15 (of 31 total)
  • You must be logged in to reply to this topic.