Forums

WP-PageNavi
[resolved] Custom query and form submit (5 posts)

  1. osterman
    Member
    Posted 8 months ago #

    I'm trying to create a custom query from a form submit with two dropdown boxes. The form is sending the $region and $job as POST vars.

    This is the custom query used in my template:

    query_posts( array(
    	'paged' => get_query_var('paged'),
    	'orderby' => 'title',
    	'posts_per_page' => 25,
    	'order' => 'ASC',
    	'category__and' => array( $region, $job ) ) );

    The first page with results works fine but when i navigate to page 2,3,4 etc they are blank. I would greatly appreciate any help.

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. scribu
    Member
    Posted 8 months ago #

    It depends if you're on a custom page template or in some other theme file:

    http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html

  3. osterman
    Member
    Posted 8 months ago #

    I'm using a custom page template and I've tried using both "get_query_var('page')" and "get_query_var('paged')" like your example shows and I get the same result.

  4. scribu
    Member
    Posted 8 months ago #

    Ah... well, the thing is that POST variables are not transmitted when you click on the links generated by WP-PageNavi.

    You would have to either:

    a) make each link an actual <form> element with hidden inputs that pass the data.

    or

    b) use GET variables instead.

  5. osterman
    Member
    Posted 8 months ago #

    Thank you! That did it!
    I tried the GET version and that did the trick!

Reply

You must log in to post.

About this Plugin

About this Topic