Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry as you was oldest first last line should read:

    $query->set(‘order’, ‘ASC’);

    • This reply was modified 9 years, 1 month ago by hyperbytes.

    Firstly, assuming you are using a child theme the following will allow you to specify if a category, tag or author is shown. It should be added to your child theme functions.php
    (code from stackexchange.com).
    add_filter( ‘get_the_archive_title’, function ($title) {
    if ( is_category() ) {
    $title = single_cat_title( ”, false );
    } elseif ( is_tag() ) {
    $title = single_tag_title( ”, false );
    } elseif ( is_author() ) {
    $title = ‘<span class=”vcard”>’ . get_the_author() . ‘</span>’ ;
    }
    return $title;
    });
    Secondly again add this code to your child theme functions.php code which allows you to specify how the posts are ordered etc. (reoplace “XXXX” with your post type

    function my_pre_get_posts( $query ) {

    // do not modify queries in the admin
    if( is_admin() ) {

    return $query;

    }

    // only modify queries for ‘xxxx’ post type. This code can be duplicated and repeated for multiple post types
    // simply change meta-key as required and order as required
    if( isset($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] == ‘XXXX’ ) {

    $query->set(‘orderby’, ‘meta_value’);
    $query->set(‘meta_key’, ‘order’);
    $query->set(‘order’, ‘DESC’);

    }

    }

    Thread Starter hyperbytes

    (@hyperbytes)

    Thanks Chad, problem solved!

    Could it simply be a cache issue? I find that pages often don’t refresh correctly if only an “element” of the page is changed, especially with some fast cache plugins.. Try forcing a refresh by adding a parameter to the end of the string i.e. add something like ?x=1 which will force a full page refresh. Alternatively clear your browser cache.

Viewing 4 replies - 1 through 4 (of 4 total)