• Resolved amberkaur

    (@amberkaur)


    My website is:
    https://www.innovationinhand.com

    I have a static front page but want to remove the title where it says “Home” on the page. I checked other threads and it said to remove

    <h2><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></h2>

    or something similar on the page.php file. My page.php doesn’t have any of that. It just looks like this

    get_header(); ?>
    
    		<div id="primary">
    			<div id="content" role="main">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', 'page' ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>

    Am I missing something here? What’s the best way to get rid of the “Home” title on the page? Also, I would like to keep the titles on the other pages. Thanks for your help in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi

    You are using the twentyeleven theme, and the code you are looking for is in content-page.php, not page.php

    This section:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<h1 class="entry-title"><?php the_title(); ?></h1>
    	</header><!-- .entry-header -->

    Changing this
    <h1 class="entry-title"><?php the_title(); ?></h1>
    to this

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

    should do what you are after. It tells WordPress not to print the page title on the static home page.

    HOWEVER it creates another problem. When you upgrade WordPress, sometimes the twentyeleven theme is also upgraded. Since it appears you have customized the default twentyeleven theme, your customizations will be lost when they are overwritten with a newer version of the theme.

    You either need to set your theme up as a child theme of the twentyeleven theme (https://codex.www.ads-software.com/Child_Themes)
    or you need to change the name of the folder your theme is in, and change the name of the theme in the comments block at the top of theme file style.css to prevent your theme from being overwritten during WordPress updates.

    If you have already done one of those you are ok. But it appears you have customized the default 2011 theme while leaving its name and folder as twentyeleven.

    Thread Starter amberkaur

    (@amberkaur)

    Wow, thank you so much. That was exactly what I needed. I will set the theme to be a child theme. Thanks again!

    Add this to your child theme style sheet:

    /*Takes away page title on Home Page only*/
    body.home .entry-title {
    	display: none;

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Theme: TwentyEleven] How to remove page title from only one page?’ is closed to new replies.