• Hi,

    I thought I understood filters, but I guess not.

    I’m trying to have all listings (other than home page)??display in alphabetical ordero.

    I have:

    function order_query($query_vars) {
    if (!is_home())
    {$query_vars[‘orderby’] = ‘title’;}
    return $query_vars;
    }

    add_filter(‘query_vars’, ‘order_query’);

    no luck.

    any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You need to use query_string not query_vars.

    function order_query($query_string) {
    if (!is_home()) {
    $query_string = add_query_arg('orderby', 'title', $query_string);
    }
    return $query_string;
    }

    add_filter('query_string', 'order_query');

    Thread Starter dmclark

    (@dmclark)

    Ah, ok, this helps a tad.

    My problem now is that these are appended on to $wp_query in a weir way, and I end up with something like

    cat=22&full=1?orderby=tittle&order=asc&posts_per_page=10000

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘setting sortby’ is closed to new replies.