I’d like to remove the post title from my static frontpage. Just that page.
I’ve created a child theme from a free Press75 theme. So I’d like to make this change in my child theme’s function.php.

I used this code but it removes the title from all pages, posts and my navigation:

add_filter( 'the_title', 'remove_page_title' );

function remove_page_title() {
    if(is_page('138')) {
    }
    return '';
}

I thought it would just remove the title from the page with ID 138.
What am I doing wrong?

Thanks!

5 Answers
5

wrap your add_filter function call around a conditional tag and use the builtin return false function:

if ( is_page('138') )
{
      add_filter( 'the_title', '__return_false' );
}

Leave a Reply

Your email address will not be published. Required fields are marked *