Killersites Community: Wordpress programming - Killersites Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Wordpress programming

#1 User is offline   virtual 

  • PipPipPipPip
  • View blog
  • Group: Advanced Member
  • Posts: 881
  • Joined: 29-December 08
  • LocationLa Jolla, California

Posted 24 September 2011 - 06:33 AM

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('&laquo; Older Entries') ?></div>
	<div class="prev-posts"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
</div>


Any help would be greatly appreciated.
Lynne
180virtual
0

#2 User is offline   Ben 

  • View blog
  • Group: Administrators
  • Posts: 5,409
  • Joined: 19-December 08
  • LocationChico, CA

Posted 24 September 2011 - 10:29 AM

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/201...tion-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....ess-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.
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
0

#3 User is offline   virtual 

  • PipPipPipPip
  • View blog
  • Group: Advanced Member
  • Posts: 881
  • Joined: 29-December 08
  • LocationLa Jolla, California

Posted 24 September 2011 - 11:56 AM

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
Lynne
180virtual
0

#4 User is offline   Ben 

  • View blog
  • Group: Administrators
  • Posts: 5,409
  • Joined: 19-December 08
  • LocationChico, CA

Posted 24 September 2011 - 12:22 PM

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.
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
1

#5 User is offline   virtual 

  • PipPipPipPip
  • View blog
  • Group: Advanced Member
  • Posts: 881
  • Joined: 29-December 08
  • LocationLa Jolla, California

Posted 24 September 2011 - 12:56 PM

OK thanks a lot
Lynne
180virtual
0

#6 User is offline   virtual 

  • PipPipPipPip
  • View blog
  • Group: Advanced Member
  • Posts: 881
  • Joined: 29-December 08
  • LocationLa Jolla, California

Posted 25 September 2011 - 10:13 AM

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.

This post has been edited by virtual: 25 September 2011 - 10:14 AM

Lynne
180virtual
0

#7 User is offline   seemasaiyom 

  • View blog
  • Group: New Members
  • Posts: 3
  • Joined: 05-November 11

Posted 05 November 2011 - 03:41 AM

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]
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users