• Hi, i’d like to know if it’s possible (i am sure it is and it must be easy but i can’t figure it out) to hide the page title only on a certain page. I mean to hide the <h1> or <h2> tag that contains the page title, not <title> of the html page.

    i tried with:

    add_filter("the_title", "hide_title");
    
    function hide_title($title ){
        global $post;
    
        //5 is the id of the page where i want to hide/replace the title
        if ($post->ID == 5) {
            $title = 'Replaced title';
        }
        return $title;
    }

    but it affects all my menu titles (in the nav). They are ‘Replaced title’ and i have no way to replace the title of a single page.
    Also, i want to keep the original nav titles, just want to change the title inside a page. Any help or hints?
    thanks in advance!

Viewing 1 replies (of 1 total)
  • Use a different pagetemplate for that page.
    Or, use conditional tags, like so:

    <?php if ( !is_page('page-slug') ) {?>
    <?php the_title(); ?>
    <?php } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to replace/hide page title on front-end’ is closed to new replies.