WordPress.org

Support

Support » How-To and Troubleshooting » Category not sorting error

Category not sorting error

  • The current template we are using is not sorting the categories properly. Instead no matter what category the post is placed under the result is that upon clicking the link all posts are displayed, rather than the specific post.

    The code in full is:

    <?php
    get_header();
    ?>
    
    <div id="single">
    <h2><?php single_cat_title(); ?></h2>
    </div>
    
    <br />
    
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('showposts=5'.'&paged='.$paged);
    ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    <div class="post">
    
    	<div class="post-left">
    		<?php
    		$args = array(
    			'post_type' => 'attachment',
    			'numberposts' => 1,
    			'post_status' => null,
    			'post_parent' => $post->ID
    			);
    		$attachments = get_posts($args);
    		if ($attachments) {
    			foreach ($attachments as $attachment) {
    		?>
    			<div class="image-preview">
    				<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo wp_get_attachment_thumb_url($attachment->ID) ?>" border="0" alt="" /></a>
    			</div>
    		<?php } }?>
    
    		<?php the_time('j M Y') ?> <?php edit_post_link('(Edit)','',''); ?>
    	</div>
    
    	<div class="post-right">
    		<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title();?></a></h3>
    
    		<?php the_excerpt_reloaded(55, '<b><i><a><strong>', 'excerpt_rss', FALSE, '', FALSE, 1, TRUE); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><b>Read More</b></a>
    	</div>
    
    </div>
    
    <?php endwhile; ?>
    
    <?php if(function_exists('wp_pagenavi')) { ?>
    
    <?php wp_pagenavi(); // ?>
    
    <?php } else { ?>
    
    <div class="left"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="right"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    
    <?php } // End if-else statement ?>
    
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Category not sorting error’ is closed to new replies.
Skip to toolbar