• i have a special category template im using for a specific category. but i want to control the amount of posts displayed separately from what the wordpress reading settings are set to. the pagination when clicked to the next page displays the same posts and not the older ones. i have been searching the codex and cant seem to get the right fix. could someone lead me in the direction, i would really appreciate it. this is where im left off of trying different query’s….. i have tested many more but i figured i would post this since i havent had success with anything. thanks in advance for any help! here is my code –

    <?php 
    
    get_header(); ?> 
    
    <?php get_sidebar(); ?>
    <?php
    global $wp_query;
    query_posts(
    	array_merge(
    		array('cat' => 3),
    		$wp_query->query
    	)
    );
    
    ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div class="recent-news">
    
    	<div class="post-thumbnail">
    	<?php the_post_thumbnail(); ?>
    	</div><!--end post-thumbnail-->
    	<div class="latest-news">
    	<div class="post-title"><h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></div>
    		<p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,40); ?>... <a href="<?php the_permalink(); ?>">Read More</a></p>
    		 <div class="datetime"><?php the_author(); ?> - <?php the_time('l, F j, Y G:i'); ?> <?php comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); ?></div>
    		</div><!--end latest-news-->
    	</div><!--end recent-->
    
    <?php comments_template(); // Get wp-comments.php template ?>
    
    <?php endwhile; else: ?>
    
    <h2>Woops...</h2>
    
    <p>Sorry, no posts we're found.</p>
    
    <?php endif; ?>
    <div class="clearfloat"></div>
    
    <div id="post-nav"><p align="center"><?php posts_nav_link(); ?></p></div><!--end post-nav-->
    
    </div><!--end wrapper-->
    
    <?php get_footer(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • well im trying to do pretty much what your doing though im just having some problems with the way the posts come out on the page maybe you could figure it out, but it works basically. heres my post Here

    Its has the ability to control what category posts it displays using the custom fields in the page editor, simple write category in the “name box” and your category you want in the “value box”. Also its can show a number of posts that you change in the template and then shows the rest as titles. but you can take that part out. Not much of a coder, hope you can tell what parts are which but here the link to the template i put together template page of posts

    I finally got it, i made the template work now like a normal blog posts sorted by category, creating 3 or however many you want featured posts, having the read more feature work with the posts, and have the style.css control the styles of the texts and titles.

    These had good info on building a template with posts and sorting by category and other things The Loop

    I figured out that you have to pretty much manually add a few things to a template page for it to work right.

    So here is the final template My Page of Posts category template i made

    to pick what category is uses for the posts. You go to the page editor and in the “custom fields” “name” write category, then in “value” write the category of the posts you want. To change the number of posts it shows you change the number here <?php if ($count <= 3) : ?>

    but basically you can use parts of the code here to get it to do what you want, im sure it can help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pagination on category template problem’ is closed to new replies.