Page Title - Remove from Page

Hello! What code do I add or replace to reconfigure the theme so that the page titles do NOT appear and the pages themselves? I am using the child theme so I am not sure if I need to change or replace code in both the parent and child theme. Thanks so much! :slight_smile:

  • Mason

    Hiya randit,

    Keeping all changes in the child theme is always a plus as you won't lose those changes during a theme upgrade.

    This one, however, is a bit more complex to pull off, but I'll try to walk you through it:

    1. From your parent theme, copy page.php to your child theme folder.
    2. Open up your new page.php file and delete lines 10-14
    3. In the parent theme, open the following: network/library/functions/loop-functions.php
    4. Scroll down to line 199 if you are using buddypres - go to line 217 if just using WordPress
    5. Copy lines 199-209 (for buddypress) or lines 217 - 228
    6. Now go back to your new page.php file in your child theme. In the blank line where lines 10-14 used to be, paste the new lines of code.
    8. Now the first line of copied text (starts at line 10) look like this:
    while (have_posts()) : the_post(); ?>

    Let's change it to look like this:
    <?php while (have_posts()) : the_post(); ?>

    9. Finally, at the very end of the newly pasted code you should see this:

    <?php comments_template('', true); ?>
    <?php endwhile;

    Add this to the end to close the endwhile statement:

    <?php comments_template('', true); ?>
    <?php endwhile; ?>

    Save the file. If you've done everything correctly - you're page template will look exactly the same as it did before!

    I know, I know... not what we're going for. But now that we've verified we've made all the changes correctly, go back into page.php and look for this line (should be line 11):
    <h2 class="pagetitle"><?php the_title(); ?></h2>
    It's there regardless of whether or not you're using buddypress.
    Delete this line.

    Save the file again. The title is now removed and you have your own custom child theme. You can safely upgrade your parent theme with no worries.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.