Forums

.php code help, (8 posts)

  1. bespokeordie
    Member
    Posted 2 years ago #

    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

  2. iridiax
    Member
    Posted 2 years ago #

    For pagination with query_posts:

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

    And use: &posts_per_page=30

  3. bespokeordie
    Member
    Posted 2 years ago #

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

  4. iridiax
    Member
    Posted 2 years ago #

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

  5. bespokeordie
    Member
    Posted 2 years ago #

    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.

  6. bespokeordie
    Member
    Posted 2 years ago #

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

  7. iridiax
    Member
    Posted 2 years ago #

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

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

  8. bespokeordie
    Member
    Posted 2 years ago #

    no other loop, i've tried this a thousand different ways. I know I am missing something basic.

Topic Closed

This topic has been closed to new replies.

About this Topic