Support » Themes and Templates » Remove page title on homepage using TwentyEleven theme – blank page

  • Resolved glenbelt



    I’m trying to hide the page title on my homepage which is using Twenty Eleven theme.

    I went into my theme, took content-page.php, copied it, renamed it to content-page-notitle.php, added this line to the top:

    Template Name: Homepage (No Title)

    and went down and deleted this code:

    <h1 class=”entry-title”><?php the_title(); ?></h1>

    I then uploaded this new file via ftp to the location of the other .php files within the theme, then I opened my homepage in wordpress and selected the new page template.

    Now when I view my page the homepage is just blank –

    The other pages are still working.

    Any idea what I’m doing wrong?
    Thanks for any help

Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael


    Forum Moderator

    content-page.php does not have all the needed codes for a page; it is only the core part to output the page specific content.

    check page.php for all the other necessary codes, and see that ‘content-page.php’ is called from within page.php using the get_template_part() line.

    you would need to create a page template based on page.php, add the necessary ‘Template Name’ part, change this get_template_part('content','page-notitle'); and save is as page-notitle.php (for example).

    keep your content-page-notitle.php (but remove the ‘Template Name’ part)

    The file you have cloned is not the entire code you need to make it work that way. You could just add a little CSS to remove it on the home page only. First find the page id of the page you have made static, eg, 2, then add the following.

    .page-id-2 .entry-title {
    display: none;

    Really grateful for that help, thanks guys.
    Still having problems though – I thought I’d nailed it after the advice from alchymyth.

    I’ve copied and pasted page.php, renamed it to page-notitle.php and got this code:

    Template Name: Homepage (No Title)

    get_header(); ?>

    <div id=”primary”>

    <div id=”content” role=”main”>

    <?php while ( have_posts() ) : the_post(); ?>

    <?php get_template_part( ‘content’, ‘page-notitle’ ); ?>

    <?php comments_template( ”, true ); ?>

    <?php endwhile; // end of the loop. ?>

    </div><!– #content –>

    </div><!– #primary –>

    <?php get_footer(); ?>

    And then I removed the template name part of content-page-notitle.php like so:


    * The template used for displaying page content in page.php
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0

    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>

    <header class=”entry-header”>

    </header><!– .entry-header –>

    <div class=”entry-content”>

    <?php the_content(); ?>

    <?php wp_link_pages( array( ‘before’ => ‘<div class=”page-link”><span>’ . __( ‘Pages:’, ‘twentyeleven’ ) . ‘</span>’, ‘after’ => ‘</div>’ ) ); ?>

    </div><!– .entry-content –>

    <footer class=”entry-meta”>

    <?php edit_post_link( __( ‘Edit’, ‘twentyeleven’ ), ‘<span class=”edit-link”>’, ‘</span>’ ); ?>

    </footer><!– .entry-meta –>

    </article><!– #post-<?php the_ID(); ?> –>

    But now when I go to the homepage it is displaying it without css styling (I think) –
    But at least the title isn’t displaying now, so that worked!

    Thanks for any more help



    Forum Moderator

    you added an excess ?>:

    should be:

    Template Name: Homepage (No Title)
    get_header(); ?>

    Oops, that’s brilliant, thanks again 🙂

    I have the same issue of wanting to remove the page title but took the easier route suggested here by Brad and added the css code to my child css page. Was very pleased until I figured out that the page is untitled in the title bar and that is an accessibility error. Is there an easy solution to this too? The php solution by alchymyth looks a little involved, not sure I get it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove page title on homepage using TwentyEleven theme – blank page’ is closed to new replies.