WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. osterman
    Member
    Posted 3 years 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
    Plugin Author

    Posted 3 years 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 3 years 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
    Plugin Author

    Posted 3 years 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 3 years ago #

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

  6. rereradu
    Member
    Posted 2 years ago #

    I'm in the same situation. I don't want to use the GET variables, so how would I go about making each link an actual form element, like you suggested?

    Thx.

  7. Umesh Nevase
    Member
    Posted 2 years ago #

    Hi rereradu,
    I also dont want to use GET variables. How do you created each link as an form element.
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic