virtual Posted September 24, 2011 Report Share Posted September 24, 2011 I am customizing a wordpress template running on Genesis and have run into a problem. My client wants the home page to paginate and I am having some difficulty doing it. The Gallery page code is <div class="homepage-gallery"> <?php $recent = new WP_Query(array('cat' => genesis_get_option('gallery_cat'), 'showposts' => genesis_get_option('number_images'))); while($recent->have_posts()) : $recent->the_post();?> <div class="polaroid-bg"> <div class="boxgrid slidedown"> <a href="<?php the_permalink() ?>" rel="bookmark"><?php genesis_image(array('format' => 'html', 'size' => 'Gallery', 'attr' => array('class' => 'cover'))); ?></a> <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php $title = the_title('','',FALSE); echo substr($title, 0, 60); ?></a></h3> <p>by <?php echo genesis_get_custom_field('nickname'); ?></p> </div> </div> <?php endwhile; ?> </div> I have figured out that I need to change the first 2 lines so I changed them to: <?php $recent = new WP_Query(array('cat' => genesis_get_option('gallery_cat'), 'showposts' => genesis_get_option('number_images'))); while(have_posts()) : the_post();?> but now I only get 10 posts instead of the 15 and then I need to add the navigation, something like this but I must be missing a bit of php somewhere. <div class="navigation"> <div class="next-posts"><?php next_posts_link('« Older Entries') ?></div> <div class="prev-posts"><?php previous_posts_link('Newer Entries »') ?></div> </div> Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted September 24, 2011 Report Share Posted September 24, 2011 Oddly enough, the stock Wordpress install doesn't come with pagination -- that's something that has to be done with a plugin or custom code. You may want to talk to Genesis about this directly -- perhaps the framework has built in support for pagination? http://www.studiopress.com/contact This might be helpful: http://skyje.com/2010/02/5-excellent-wordpress-pagination-solutions/ and I've personally used the Wordpress PageNavi plugin before. This is a brief runthrough of how to install/use the WP PageNavi plugin: http://www.hongkiat.com/blog/adding-nice-wordpress-pagination/ The code you have above would reduce the number of posts on the home page and add next/previous links, but it won't show pagination. Quote Link to comment Share on other sites More sharing options...
virtual Posted September 24, 2011 Author Report Share Posted September 24, 2011 Thanks for your reply Ben, I tried Studio Press first of course, but they say the question is beyond the scope of their forum and to hire some to customize, but I'm trying to learn how to do all this myself. I will take a look at the pagination plugins. So for future reference, does the code I replaced reduce the number of images to 10, because I have set blog pages to show 10 posts? And could you please explain why this statement is used <?php $recent = new WP_Query etc.. instead of the regular wp loop. Thanks Quote Link to comment Share on other sites More sharing options...
falkencreative Posted September 24, 2011 Report Share Posted September 24, 2011 I know very little about the Genesis framework, so I'm not sure exactly how it works... I think, though, that they are using custom post types to store those images. Custom post types usually require a customized WP loop, since you have to specify which post type you want to display. And yes, unless you manually set the number of items to retrieve in the WP_Query, it will return the default value set within the WP admin. 1 Quote Link to comment Share on other sites More sharing options...
virtual Posted September 24, 2011 Author Report Share Posted September 24, 2011 OK thanks a lot Quote Link to comment Share on other sites More sharing options...
virtual Posted September 25, 2011 Author Report Share Posted September 25, 2011 (edited) Thanks to your help Ben, I managed to get the pagination to work. I'm not very impressed with the StudioPress help forum, I got no help whatsoever from them. Edited September 25, 2011 by virtual Quote Link to comment Share on other sites More sharing options...
seemasaiyom Posted November 5, 2011 Report Share Posted November 5, 2011 Hi, i have a little knowledge of that but i am interested to know more about that.. this information can be helpful for me as well as for others.. Thanks. [De-spammed] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.