Double Headlines on pages only… please advice

Valued Support-Team,

meanwhile we had to update our theme. After that we recognized that on pages the headlines were eliminated instead was a html code visible.

We added within theme folder on page.php the following line of code but now the Headlines are doubled.

<!– THE TITLE –>

<h1><?php the_title(); ?></h1>

<?php if ($cmb_hide_page_title != “checked”:wink: { printf(‘<h1>%s</h1>’, get_the_title()); } ?>

Please be so kind and tell us, what is wrong with the inserted code to get rid of the double effect as shown in attached screenshot.

Thanks in advance.


  • Sajid
    • DEV MAN’s Sidekick

    Hi @prinz! Hope you are doing good today :slight_smile:

    You are calling “the_title” and “get_the_title” in page.php file. Both functions does the same thing, that is display page titles. You should remove either the first line or second line from your page code to display.

    In below line, I assume that you have a checkbox in pages, when you check mark this option the title will be hidden from page. If its correct, then use this line of code only and remove the first line of your code.

    <!-- THE TITLE -->
    <?php if ($cmb_hide_page_title != "checked") { printf('<h1>%s</h1>', get_the_title()); } ?>

    It is always good practice to use a child theme for customizations. Creating child theme is easy and can be done either one click child theme creator plugin or manually following simple steps in this blog post.

    Now you have your newly created child theme :slight_smile: Then copy and paste page.php file in your child theme and make changes there. Changes in child theme will not be eliminated/erased when you next time update your parent theme :slight_smile:

    Take care and have a nice weekend :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.