Reply To: php function to remove page titles no longer working

Homepage Community Forums Legacy Theme Support php function to remove page titles no longer working Reply To: php function to remove page titles no longer working

#10631
Danna McCormick
Customer

    Eric,
    Thanks for the link. I went back and tried the line with the correct characters and what I found was that it removed both Page and Post titles. I only want to remove Page titles (so I can add my own h1 headers).

    However, the link your provided is great. If I’m understanding it all correctly, there is not a way to remove all Page titles only because both Page and Post titles use the same genesis_entry_header. So, this code which specifically calls page titles – and I simply have to type in the Page IDs – will work best for my purposes.

    
    //* Remove page title for multiple pages (requires HTML5 theme support)
    //* Change page ids to match your needs
    add_action( 'get_header', 'child_remove_page_titles' );
    function child_remove_page_titles() {
    $pages = array( 63,65,67 );
    if ( is_page( $pages ) ) {
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    }
    }
    

    Thanks so much for the resources!