• Hello friends,
    I need help, I am facing a wired problem & I need help.
    In my custom theme I am using CSS + images to display the page title on each page, to do so I used the following code;
    <h1 class="entry-title"><span><?php if ( ! is_page('home') ) { wp_title( '', true, 'right' );} else { ?>Home <?php } ?></span></h1>

    PROBLEM:
    Every page (except the Post Page) is displaying the Page title twice because of the loop used for post, here is the code for that;

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <h2 class="post-title"><span><?php the_title(); ?></span></h2>
    <div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
    </div><!-- .entry-content -->
    </div><!-- #post-## -->
    <?php comments_template( '', true ); ?>
    <?php endwhile; ?>

    If i remove the_title() from the post loop then problem is solved but then all posts are displayed without the title.
    To see the problem kindly visit my site http://www.mentorarts.com/wordpress/advpress/

    Please I need help, I am badly stuck at this issue and I have limited knowledge about WordPress.

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • You did not show how your code relates to the code for the post loop. Where is your code placed?

    This is just a guess, but try replacing this:

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <h2 class="post-title"><span><?php the_title(); ?></span></h2>
    <div class="entry-content">

    with this:

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if (++$counter > 1) { ?>
    <h2 class="post-title"><span><?php the_title(); ?></span></h2>
    <?php } ?>
    <div class="entry-content">
    Thread Starter czone

    (@czone)

    Both the codes are on the same page index.php
    I used twentyten theme codes (page.php) as reference.

    I tried your method, it did hide the doubling of Page title on all pages but at the blog page there is no heading as well + only the recent blog is showing.

    Both the codes may be in index.php, but that does not give enough information about how they are related.

    Can you provide a link showing the results of adding the code I suggested?

    EDIT: It is late here now. I will have to look at this again tomorrow.

    Thread Starter czone

    (@czone)

    you can see the results at this link
    http://www.mentorarts.com/wordpress/advpress/

    (BLOG PAGE IS MY DEFAULT POST PAGE)

    Thread Starter czone

    (@czone)

    here is the full code from index.php file including your code

    <?php get_header(); ?>
    
    <div class="container">
    <div class="content" role="main">
    
    <div class="pagename"><h1 class="entry-title"><span><?php if ( ! is_page('home') ) { wp_title( '', true, 'right' );}  else { ?>Home <?php } ?></span></h1>
    <div class="custom-search" role="complementary">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Primary-TopSearch') ) : else : ?>
    <?php endif; ?>
    </div></div>
    
    <div class="side_bar"> <?php get_sidebar(); ?></div>
    <div class="content-main one-column">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if (++$counter > 1) { ?><h2 class="post-title"><span><?php post_title(); ?></span></h2><?php } ?>
    <div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
    </div><!-- .entry-content -->
    </div><!-- #post-## -->
    
    <?php comments_template( '', true ); ?>
    <?php endwhile; ?>
    </div><!-- #content-main -->
    </div><!-- #content -->
    </div><!-- #container -->
    
    <?php get_footer(); ?>
    Thread Starter czone

    (@czone)

    Thanks vtxyzzy,
    I solved the problem, here is what i did

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

    I really appreciate your help, it gave me the clues to try some tricks and one of them worked 🙂

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

The topic ‘Removing Page title’ is closed to new replies.