• I’am trying to do a filter link for posts in same category, sorting by meta_key, orderby meta_value in order ASC, using in a category-3.php file.

    I used the query string in a link ej: <?php bloginfo(‘url’); ?>/category/economic-and-cultural/?meta_key=country&orderby=meta_value&order=ASC but it doesn’t work. If I change de meta_key

    If a use the query_post in a themepage it works, but the pagination doesn´t.

    Can somebody help me.
    Sory for my bad english and thank you..

Viewing 2 replies - 1 through 2 (of 2 total)
  • hello,

    i think the query_post thing can do something with the words “meta_key” and “meta_value”

    but for the link you should use variables, like $meta_key

    so you should turn your meta keys and values into variables

    my english is een worse than yours !

    This..

    <?php bloginfo('url'); ?>/category/economic-and-cultural/?meta_key=country&orderby=meta_value&order=ASC

    Is already a query string, it’s requesting a category…

    Try

    <?php bloginfo('url'); ?>/category/economic-and-cultural/&meta_key=country&orderby=meta_value&order=ASC

    For testing it might be useful to check which query vars were picked up by WordPress..

    Place this before your query, just to check which vars are showing as being set/declared/queried..

    <pre><?php print_r( array_filter( $wp_query->query_vars ) ); ?></pre>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sorting post by meta_key, orderby=meta_value and order=ASC in same category’ is closed to new replies.