• Resolved janleeks

    (@janleeks)


    Hello,

    I have a problem getting my tag.php pages that hold tagged posts from my site to order the resulting contents.

    I want the items to appear in alphabetical order, and although adding

    <?php query_posts('posts_per_page=5&&category_name=clients&orderby=title&order=asc');
      ?>

    to my category(CLIENTS) page works (https://sitepreview.annscott.co.uk/clients), when I try to apply to my tag.php page it doesn’t display the posts in alphabetical order.
    https://sitepreview.annscott.co.uk/tag/americas

    Here is the code I have in the tag.php page

    <ul id="destinations">
    <li class="header first"><?php wp_title(); ?></li>
    <?php while (have_posts()) : the_post(); ?>
    <li id="post-<?php the_ID(); ?>">
    <div class="imagehold2">
    <?php the_content(__('(more...)')); ?></div>
    <span class="desheader"><?php the_title(); ?></span>
    <?php the_excerpt(); ?>
     </li>
    <?php endwhile; ?>
    </ul>

    I’ve tried several different things and can’t fix, any help would be greatly received.

    jan

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php query_posts('posts_per_page=5&&category_name=clients&orderby=title&order=asc'); ?>

    where do you have that query?

    Thread Starter janleeks

    (@janleeks)

    When I add that to the tag.php template, anywhere at all, the page doesnt work (I get a blank page). The full page for the tag.php is

    <?php
      get_header();
      if (have_posts()): ?>
     <?php include (TEMPLATEPATH . '/nav2.php'); ?>
          <div id="maincontent">
          <div id="intro">
    			        <h1>CLIENTS</h1>
    					<p class="introcopy">Luxury hotels, resorts, villas & restaurants; glamorous
    					  spas, health retreats & beauty products; specialist travel companies;
    				    family holidays; yoga, golf & ski.</p>
    					<p class="bottomheader">&nbsp;</p>
    
    				</div>
    
                     <div id="secondaryContent">
            <?php include (TEMPLATEPATH . '/testsidebar.php'); ?>
          </div>
    
      <ul id="destinations">
    
      <li class="header first"><?php wp_title(); ?></li>
    
      <?php while (have_posts()) : the_post(); ?>
    
       <li id="post-<?php the_ID(); ?>">
    
         <div class="imagehold2">
    	 <?php the_content(__('(more...)')); ?></div>
    
          <span class="desheader"><?php the_title(); ?></span>
    
           <?php the_excerpt(); ?> 
    
     </li>
        <?php endwhile; ?>
      </ul>
    <?php else: ?>
      <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php
      endif;
      ?>
       <div id="pagination" class="noline">
    
         <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>
    
       <div class="top"><a href="#">back to top</a></div>
        </div>
    
      <?php
      get_footer();
    ?>
    Thread Starter janleeks

    (@janleeks)

    I managed to fix this…

    i added

    <?php $posts=query_posts($query_string . '&orderby=title&order=asc');
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    where I previously had

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

    and removed at the top of my page where I once had

    <?php
    
      get_header();
    
      if (have_posts()): ?>

    i just have

    <?php
    
      get_header();
     ?>

    Easy when you know how, I hope this helps someone…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ordering in a tag.php page’ is closed to new replies.