- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
July 1, 2014 at 10:38 am #174258
herbyderby
ParticipantHello all,
I am having the hardest time simply paginating a category of posts. I’ve looked at many forums, codexes, and Google results to no avail. What the heck am I doing wrong here?
The code:
<?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); /* THE LOOP */ ?> <div id="pageHeader"><?php the_block('Page Header'); ?></div> <div id="pageEntry" class="group"> <div class="inner group"> <h2 class="pageTitle"><?php the_title(); ?></h2> <?php $posts = get_posts("posts_per_page=5&cat=15,22"); ?> <?php if( $posts ) : ?> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?> <article class="projects group"> <div class="leftProjCol group"><?php echo get_the_post_thumbnail($post->ID, 'feat-thumb'); ?></div> <div class="rightProjCol"> <h2 class="projectTitle"><a href="<?php echo get_permalink(); ?>"><?php echo $post->post_title; ?></a></h2> <div class="thePost"> <p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,60); ?> </p> <?php //echo apply_filters('the_content', $post->post_content); ?> </div> <a class="readOn" href="<?php echo get_permalink(); ?>">Read More</a> </div> </article> <?php /* Keep these three lines out to separate each article */ ?> <?php endforeach; ?> <?php endif; ?> <?php wp_reset_postdata(); #clean up ?> <div id="pagWrap" class="group"><span class="prev"><?php previous_post_link('%link', 'Previous in category', TRUE); ?></span><span class="next"><?php next_posts_link(); ?></span></div> </div> </div> <?php endwhile; ?> <?php endif; ?>
Thanks in advance.
July 3, 2014 at 11:01 am #174516mcjohnst
ParticipantI’d recommend converting this over to using WP_Query along with properly set paged params.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘Back End’ is closed to new topics and replies.