Support » Fixing WordPress » Hide post titles

  • Resolved evilsandwich

    (@evilsandwich)


    So i’m setting up my 2nd wordpress site and i remember an option to “show/hide post titles”.. now i cant find that option for the life of me.. currently my titles are hidden on 1 page and showing on the other..

    anyone know where that option is?

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is not WordPress standard, but it would be a feature of the theme, if it is not in Admin > Appearance > Theme Options then it is likely that your theme does not support it.

    As you are saying this is your second WordPress website, I will answer this as I would for a Novice.

    We would need to know which theme you are using, or you can look for yourself, in the themes folder there will be a file called page.php

    Lets work through an example with twenty ten, we open page.php, look for and find the code the_title() which is a function call.

    <?php if ( is_front_page() ) { ?>
    	<h2 class="entry-title"><?php the_title(); ?></h2>
    <?php } else { ?>
    	<h1 class="entry-title"><?php the_title(); ?></h1>
    <?php } ?>

    the_title() is how we identify the page title, and the element is identified by the class=”entry-title”, so we have to hide the title, to do this we can add a css inline style to the element style=”display: none;”

    There are two ways to do this one is modify the file and upload it via ftp, the second is from Admin > Appearance > Editor and find the page.php file.

    <?php if ( is_front_page() ) { ?>
    	<h2 class="entry-title" style="display: none;"><?php the_title(); ?></h2>
    <?php } else { ?>
    	<h1 class="entry-title" style="display: none;"><?php the_title(); ?></h1>
    <?php } ?>

    If the element is still taking up real estate we can change the height as well with style=”display: none; height= 0px;”

    Why do we not just delete the code?
    You may have seen a few topics where the answer is find this code and delete it, there are a couple of costs to deleting code.

    1. By hiding the title we have a way of restoring the Header if we want to change it later.
    2. Search engines use the page title and not the menu when indexing your page, there could well be an important keyword in the page title that would bring visitors to your website

    By hiding the title the search engines will still see it and index it, but your visitors will not!

    Hope this helps.

    Novices wanting to develop themes start here.

    David 🙂

    Thread Starter evilsandwich

    (@evilsandwich)

    some themes, like P2, have a checkbox for “hide title”

    Hi Evilsandwich,
    this is the ‘Post Title’ and not the ‘Blog Title’, this is a common request to hide the ‘Page Title’.

    The page title is the ‘Post Title’, so we can hide this in the page.php file, then our blog posts have the title but our pages do not.

    HTH

    David

    I did a search and found your great “easy explained mini tutorial” on hiding page titles. Thank you Adeptris!

    Thank you adeptris for this very clear instruction. (I am a noobie for coding, but find I can learn bit by bit with instructions like yours.)

    Two questions:

    1. When WordPress does an update, will this coding fix need to be done again?

    2. Is it possible to remove the title from just one post (like the sticky post at the top of the postings page)? What would the coding be for that?

    Jan

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide post titles’ is closed to new replies.