Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127
Unnecessary pagination with search results « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

Unnecessary pagination with search results

(2 posts)
  • Started 4 years ago by joshuaiz
  • Latest reply from joshuaiz
  • This topic is resolved
  1. joshuaiz
    Member

    I want to show a specified number of posts that come back for a given search query on the search results page so I am using the following search loop:

    function childtheme_search_loop() {
    
     $my_query = new WP_Query('posts_per_page=10');
    		while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    			<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
        			<?php thematic_postheader(); ?>
    				<div class="entry-content">
    <?php thematic_content(); ?>
    
    				</div>
    				<?php thematic_postfooter(); ?>
    			</div><!-- .post -->
    
    		<?php endwhile;
    }
    add_action('thematic_searchloop', 'childtheme_search_loop');

    This returns 10 of the posts for the query. The problem I am having is with pagination - when you go to Page 2 of the results, it is still showing the first 10 posts and you can never access the next 10 posts. In addition, it is showing pagination based on 3 posts per page which is what I have in the Reading settings in wp-admin so it is listing 7 pages, even though I only have 24 posts.

    What's more, if I set ('posts_per_page=-1') I get all the posts on one page but the pagination is still there.

    How can I adjust this search loop to return a specified number of posts and then paginate the remaining results?

    Posted 4 years ago #
  2. joshuaiz
    Member

    Instead of doing my head in, I found a plugin that does this for me:

    http://moshublog.com/2007/10/30/custom-query-string-reloaded-for-wordpress-23-with-tag-support/

    Enjoy.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GA_Filter::spool_analytics() should not be called statically in /home/themes/public_html/forums/bb-includes/wp-functions.php on line 586

Strict Standards: Non-static method GA_Filter::spool_this() should not be called statically in /home/themes/public_html/forums/my-plugins/googleanalytics.php on line 183