[Support request] Global setting to exclude featured image and content title

Home Forums Support [Support request] Global setting to exclude featured image and content title

Home Forums Support Global setting to exclude featured image and content title

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #371991
    Piccia

    Hi there, I’m migrating my own site from an evil super-bloat theme to the amazing GP. So that I don’t have to trail through hundreds of posts, free image downloads and pages and turn things off manually on each item, I need a way to exclude content titles and featured images globally. I might not want to do it to absolutely every post type though.

    Thank you in advance!

    Piccia

    #372064
    Tom
    Lead Developer
    Lead Developer

    Hi Piccia,

    Do you know the specific post types you want to target or exclude?

    #372424
    Piccia

    I want to target blog posts, for sure, and Easy digital download posts. Do you need to know more?

    #372887
    Tom
    Lead Developer
    Lead Developer

    For the title, do this:

    add_action( 'after_setup_theme', 'tu_add_filters' );
    function tu_add_filters() {
        add_filter( 'generate_show_title', 'tu_cpt_remove_title' );
    }
    
    function tu_cpt_remove_title( $title ) {
        if ( 'post' == get_post_type() || 'download' == get_post_type() ) {
            return false;
        }
    
        return $title;
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    As for the featured image, it’s probably best to use some CSS:

    .single-post .page-header-image-single,
    .single-download .page-header-image-single {
        display: none;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    #379319
    Piccia

    Hi Tom, thank you so much for this!

    However, the PHP for taking the title out isn’t working. Could it be because I am using a Toolset CPT for my blog posts?

    Thank you in advance

    p.s. I don’t get the email notification for your replies. Sorry for not thanking you earlier!

    #379776
    Tom
    Lead Developer
    Lead Developer

    No problem! Can you try the updated PHP above?

    #380086
    Piccia

    I will, although in the meantime I have fully comprehended the stellar awesomeness of new page headers as well as sections so that’s now probably redundant. I think simply ditching my old Toolset post layout is the way forward. I cannot thank you enough for such an amazing theme!

    #380431
    Tom
    Lead Developer
    Lead Developer

    That’s awesome, really glad you’re enjoying it! 🙂

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