function.php

Home   »   function.php

add_action( 'pre_get_posts', 'nm_filter_category_query' );
function nm_filter_category_query( $query ) {
    // only modify front-end category archive pages
    if( is_archive()  && !is_admin() && $query->is_main_query() ) {
        $query->set( 'orderby','meta_value' );
        $query->set( 'meta_key','lot-nr' );
        $query->set( 'order','ASC' );
    }
}

Leave a Reply

Your email address will not be published.