Support » Fixing WordPress » Title tag for 6 pages all the same?

  • Resolved bencharity

    (@bencharity)


    Ok what am I missing?? I’ve been exploring more with template tweaks so I’m sure it’s something simple and I’ll kick myself…

    I have my site (http://benjamincharity.com) split in two: Personal and Freelance.

    I am using these calls in my title tag (this code is identical in my personal header (header.php) and my freelance header (header-freelance.php):

    <title><?php wp_title(); ?> | <?php bloginfo('name'); ?></title>

    Yet somehow while all the titles are correct on the personal side, every page on the freelance side is displayed as “Support | Benjamin Charity”.

    I have a blog category called ‘Support’ but I can’t figure out how it could be affecting me.

    I’m looking forward to learning something new! Thanks in advance to any kind souls!
    Benjamin

Viewing 5 replies - 1 through 5 (of 5 total)
  • bump

    No clues? Anyone?

    bump

    Ok, I’ve narrowed it down to this piece of code.

    <div id="recentPosts">
    	<h3>Recent Posts</h3>
    
    <?php
    query_posts('showposts=2&cat=7');
    while(have_posts()) : the_post();
    ?>
    
    	<div class="similarSingle">
    		<h5><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5>
    
    		<?php the_excerpt(); ?>
    
    	</div>  <!-- end .similarSingle -->
    
    <?php endwhile; ?>
    </div>  <!-- end #recentPosts -->

    Specifically I think it is this piece:

    while(have_posts()) : the_post();

    When I remove the above code from the page, my title appears correctly. Any way around this?

    Ok I have found a fix for this by adding <?php wp_reset_query(); ?> after the trouble code.

    Example:

    <?php
    query_posts('showposts=2&cat=7');
    while(have_posts()) : the_post();
    ?>
    
    <h5><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5>
    
    	<?php the_excerpt(); ?>
    
    <?php endwhile; ?>

    Should be:

    <?php
    query_posts('showposts=2&cat=7');
    while(have_posts()) : the_post();
    ?>
    
    <h5><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5>
    
    	<?php the_excerpt(); ?>
    
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>

    This took forever for me (a novice) to figure out, so hopefully this helps someone else. Also, if anyone can explain exactly why I need to manually reset the query, I’d love to know.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Title tag for 6 pages all the same?’ is closed to new replies.