Title: .php code help,
Last modified: August 19, 2016

---

# .php code help,

 *  [bespokeordie](https://wordpress.org/support/users/bespokeordie/)
 * (@bespokeordie)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/)
 * Hello,
 * I am currently using the following PHP script to display the image from my posts
   in a gallery:
 *     ```
       <?php query_posts('showposts=60'); ?>
                               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                                   <?php $wp_query->is_home = false; ?>
   
                                   <?php woo_get_image('image','thumbnail','','','thumbnail gallery'); ?>
   
                               <?php endwhile; endif; ?>
       ```
   
 * The only problem with this script is that it only displays a set number of images.
   In this case 60. Is there a way to add pagination to it so that it shows 30 images
   per page?
 * This is the script I am currently using for my pagination:
    `<?php if (function_exists('
   wp_pagenavi')) { ?><?php wp_pagenavi(); ?><?php } ?>`
 * Any help, comments, or suggestions anyone can provide would be greatly appreciated.
 * bespokeordie.com

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108473)
 * For pagination with query_posts:
 * [http://codex.wordpress.org/Template_Tags/query_posts#Example_3](http://codex.wordpress.org/Template_Tags/query_posts#Example_3)
 * And use: &posts_per_page=30
 *  Thread Starter [bespokeordie](https://wordpress.org/support/users/bespokeordie/)
 * (@bespokeordie)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108487)
 * I tried this a few different ways and had no luck. Can you show me an example?
   I inserted my loop into that code (Example 3) and got nothing. I couldn’t get
   it to work with my loop at all.
 * I tried this and it appeared to work, but when you click on the next page link
   the same images appear:
 * <?php query_posts(‘&posts_per_page=60’); ?>
    <?php if ( have_posts() ) : while(
   have_posts() ) : the_post(); ?> <?php $wp_query->is_home = false; ?>
 *  <?php woo_get_image(‘image’,’thumbnail’,”,”,’thumbnail gallery’); ?>
 *  <?php endwhile; endif; ?>
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108496)
 * You need a $query_string with your query_posts as in example 3.
 *  Thread Starter [bespokeordie](https://wordpress.org/support/users/bespokeordie/)
 * (@bespokeordie)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108572)
 * This is very aggrivating. I have done a ton of research and this should work:
 * <?php query_posts($query_string.’&posts_per_page=30′); while(have_posts()) {
   
   the_post(); woo_get_image(‘image’,’thumbnail’,”,”,’thumbnail gallery’); } ?>
 * But, no such luck.
 *  Thread Starter [bespokeordie](https://wordpress.org/support/users/bespokeordie/)
 * (@bespokeordie)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108605)
 * Ha ha, I think I hope I haven’t become that annoying guy that no one likes now.
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108606)
 * Do you have another loop anywhere on your page? See:
 * [http://wordpress.org/support/topic/57912](http://wordpress.org/support/topic/57912)
 *  Thread Starter [bespokeordie](https://wordpress.org/support/users/bespokeordie/)
 * (@bespokeordie)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108628)
 * no other loop, i’ve tried this a thousand different ways. I know I am missing
   something basic.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘.php code help,’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [bespokeordie](https://wordpress.org/support/users/bespokeordie/)
 * Last activity: [16 years, 12 months ago](https://wordpress.org/support/topic/php-code-help-3/#post-1108628)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
