Sorting post by meta_key, orderby=meta_value and order=ASC in same category (3 posts)

  1. giggiosonic
    Posted 6 years ago #

    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..

  2. 2nic
    Posted 6 years ago #


    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 !

  3. Mark / t31os

    Posted 6 years ago #


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


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

Topic Closed

This topic has been closed to new replies.

About this Topic