WordPress.org

Ready to get started?Download WordPress

Forums

Category not sorting error (2 posts)

  1. WMain00
    Member
    Posted 4 years ago #

    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(); ?>
  2. WMain00
    Member
    Posted 4 years ago #

    BUMP

Topic Closed

This topic has been closed to new replies.

About this Topic