• 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)
  • For pagination with query_posts:

    http://codex.wordpress.org/Template_Tags/query_posts#Example_3

    And use: &posts_per_page=30

    Thread Starter bespokeordie

    (@bespokeordie)

    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; ?>

    You need a $query_string with your query_posts as in example 3.

    Thread Starter bespokeordie

    (@bespokeordie)

    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

    (@bespokeordie)

    Ha ha, I think I hope I haven’t become that annoying guy that no one likes now.

    Do you have another loop anywhere on your page? See:

    http://wordpress.org/support/topic/57912

    Thread Starter bespokeordie

    (@bespokeordie)

    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.