• I have a function that sorts posts by last modified date:

    function custom_query_vars_filter($vars) {
      $vars[] = 'sortby';
      //$vars[] .= 'another';
      return $vars;
    }
    add_filter( 'query_vars', 'custom_query_vars_filter' );
    function techslides_alter_query($query){
          $sortby = get_query_var( 'sortby' );
          if( $sortby=="modified" && !is_admin() && $query->is_main_query() ){
            $query->set( 'orderby', 'modified' );
          }
    }
    add_action('pre_get_posts','techslides_alter_query');

    A ?sortbymodified gets added to the URL to return the sort order.

    How can I modify the sort order of the posts to be by which post has the newest microblog post OR update?

    The page I need help with: [log in to see the link]

  • The topic ‘Sort Main Posts by Post with newest Microblog Update’ is closed to new replies.