Ready to get started?Download WordPress


How to ignore the heading of the home page only?? (4 posts)

  1. hey2you
    Posted 6 years ago #

    Hello all,

    I want to ignore the heading of my home "static" page only and keep the heading on the other pages.

    I know the line to alter is in page.php

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

    but it seems not work, I am not a PHP expert, can some tell me the code the do this job please??


  2. ladydelaluna
    Posted 6 years ago #

    You need to create a copy of page.php and call it home.php, removing the call for the title, and WP will automatically use that for your site's index page.

    Do not delete page.php, and you will need to hard-code in your homepage content into home.php, as this page won't be able to be edited from the normal write/manage->pages section of admin.

    Other than that, if you know a little PHP, you can use "if" statements to exclude the title from that particular page. I'm just not good at it, so I use the option I mentioned above. Maybe someone else can come in and give you the PHP code.

  3. hey2you
    Posted 6 years ago #

    Thanks!! thats idea sounds good

  4. adam-s
    Posted 6 years ago #

    If you were feeling adventurous you could try...

    <?php if (!is_home()){ ?>
    <h2><?php the_title(); ?></h2>
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic