[resolved] remove page title from some pages (19 posts)

  1. annalouis
    Posted 4 years ago #

    I am using twenty ten theme and I would like to hide the page title from a couple of pages i.e. home etc.

    Could anyone advise the best way to do this?
    Kindest regards

  2. You can use conditional tags and edit your theme files, but it requires some coding knowledge.


    <?php if (!is_page(array('blah','blah2','blah3'))); ?>
    <h2><?php the_title(); ?></h2>			
    <?php endif; ?>

    This says: For pages that do not have the slug blah, blah2, and blah3, display the title.

    Reference: http://codex.wordpress.org/Function_Reference/is_page

    Another way to do it is to hide them via CSS. You'd look in the page source in a browser and find the unique body class for the pages where you want to hide the post title.

    Then in your CSS, you put the corresponding page classes and make the titles display: none (hidden). For example:

    .page-id-117 .title-class, .page-id-248 .title-class, .page-id-874 .title-class {
     display: none;

    This hides the titles for humans, but search engines would still see them. You'd have to verify the actual title class in TwentyTen.

    Warning: Do not edit the TwentyTen theme directly or all your changes will be overwritten the next time you update the theme. Use a child theme instead. There are many tutorials out there on creating child themes, such as this one.

  3. p.s. if you use the PHP conditionals method, there are different conditionals for the homepage and the front page as they are "special":

    is_home() and is_front_page()

    See the complete WordPress conditionals reference here for more info:


  4. annalouis
    Posted 4 years ago #

    Sorry which file would I change the conditional tags?

    Is it the functions file? I have created a child theme.

    Sorry I am completely new to WP. I only want to remove the page title on 3 pages. Thanks

  5. It would be whatever file where your title code is displayed - example, page.php for pages, index.php for blog homepage, etc. More about the WordPress template hierarchy:


  6. p.s. if you're really new to WordPress and not yet comfortable with editing theme files, the second (CSS) method I proposed above will likely be much easier for you.

  7. Ramy-Nasr
    Posted 4 years ago #

    Thank you Zoonini. I tried your code but it gave me an error that the endif; was misplaced or something. I changed your example a little and it worked perfectly using this code in the page.php file.

    <?php if (!is_page(array('blah1','blah2','blah3'))) { ?>
    <h1><?php the_title(); ?></h1>			
    <?php } ?>
  8. Glad you figured it out!

    Sorry about that, it should have been a colon instead of a semi-colon in the first line - but the curly brackets are fine too:

    <?php if (!is_page(array('blah','blah2','blah3'))): ?>
    <h2><?php the_title(); ?></h2>			
    <?php endif; ?>
  9. annalouis
    Posted 4 years ago #

    I have tried the css, but it doesnt work and I am not advanced enough to change the files yet.

    To hide all page titles this does work in the CSS for twenty ten:

    .page .entry-title{display:none;}

    Is there anyway of modifying this for the 3 pages i want to hide the title?

  10. Can you provide a link to your site so I can check the classes?

  11. As I mentioned above, you need to check the body class of each page where you want to hide the title. So if the classes are page-id-248 and page-id-398, for example, do:

    .page-id-248 .entry-title, .page-id-398 .entry-title {

    ... and so on. Just add more classes separated by commas, following the syntax above for as many pages whose titles you want to hide.

  12. annalouis
    Posted 4 years ago #

    many thanks for getting back to me, could you check the classes for the pages I would like to hide the page title? (When I checked the classes they come up as post.php?post=84 - is that correct?)

    Many thanks

  13. You need to open each page in a web browser, and View Source - the location of View Source in the menu is different depending on the browser.

    When looking at the source of each page, find the body tag and locate the unique class in each. Your examples above are:

    <body class="page page-id-77 page-parent page-template page-template-onecolumn-page-php custom-background">

    <body class="home page page-id-1332 page-template page-template-onecolumn-page-php custom-background">

    <body class="page page-id-84 page-parent page-template page-template-onecolumn-page-php custom-background">

    I've put each unique class in bold.

    That translates to:

    .page-id-77 .entry-title, .page-id-1332 .entry-title, .page-id-84 .entry-title {

    Does that make sense?

  14. annalouis
    Posted 4 years ago #

    yes it does, sorry i was getting confused with the page id appearing as a post not page! Thank you so much for your patience! It works!

  15. Good stuff, I'm glad you got it working!

  16. graphicvisions
    Posted 4 years ago #

    I am having the same issue with my site, but I don't see any style applied to the body of the page. Would someone be willing to take a look at my page and help me figure out how to hide the "title" on my homepage using CSS?

    This is my first time posting do I include a link to the website?

  17. esmi
    Forum Moderator
    Posted 4 years ago #

    Please post your own topic. And - yes - please include a link to your site.

  18. Erik_Jansen
    Posted 3 years ago #

    Dear Zoonini,

    1 question: Where do you put the textline in de style.css file?
    I tried different places but it does not work, can you please assist me?

    I am only trying to make the pagetitle of my home butten to disapear.

    Kind regards.
    Erik Jansen

  19. jaydokie
    Posted 3 years ago #

    In your example, what does blah1, blah2 and blah3 mean? Do I change these blah to something else?

Topic Closed

This topic has been closed to new replies.

About this Topic