Paginated posts on a static page?
-
Wow, the subject sounds complicated so I’ll quickly explain what I need help with:
I’m trying use WP as a CMS and I need static page to display posts from one category (think “latest work” on a portfolio page -> posts in “Work” category). I set it up to display latest 6 posts but I would like to have a “previous” and “next” buttons/links if there is more than 6 posts in this category. Sounds fairly easy for an actual blog but for some reason I can’t make it work on a static page.
<div id="portfolio"> <?php $breaking_cat = "1"; $breaking_num = "6"; ?> <?php $projects = new WP_Query('showposts='.$breaking_num.'&cat='.$breaking_cat.''); ?> <?php while ($projects->have_posts()) : $projects->the_post(); ?> <div class="item"> <img src="<?php echo get_post_meta($post->ID, 'project_thumb',true) ?>" alt="<?php the_title(); ?>" /> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_content(); ?> </div><!-- end item --> <?php endwhile; ?> </div><!-- end portfolio --> <div id="folioNav"> <span id="previous" class="png_bg"><?php previous_post_link('Previous') ?></span> <span id="next" class="png_bg"><?php next_post_link('Next'); ?></span> </div><!-- end folioNav -->
Any ideas on what I’m doing wrong would be appreciated. I’m fairly new to WordPress and have no other PHP experience so I gave up trying to figure it out myself :/
Thanks in advance!
Justine
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Paginated posts on a static page?’ is closed to new replies.