Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #161009
    evergreenw60
    Participant

    How do I reverse the order of Recent Posts on the front page so that the oldest post #1 is at the top of the list and the list continues on with 2, 3, etc.?

    Blog is shellyandcococreate.com

    #161027
    Skandha
    Participant

    @evergreenw60: You will need to create a child theme and do a bit of customization for this. Let me know if you are familiar with child theme customization otherwise I suggest you to hire a customizer.

    Kind Regards,
    Skandha

    #161066
    evergreenw60
    Participant

    I have no idea how to do a child theme. I don’t have the funds to hire anyone so need to do it myself. Please tell me how.

    #161161
    Skandha
    Participant

    @evergreenw60: Firstly you will need to create a child theme. If you don’t know how to create a child theme you can use Generate Child Theme Plugin. Install and Activate the plugin. Go to => Dashboard => Generate Child Theme tab => Select Parent Theme as Catch Box Pro and fill in other fields then Click Generate. This will create an activate the child theme.
    Now, Go to => Child Theme folder => functions.php and add the following Code.

    $args = array(
    'orderby' => array( 'title' => 'DESC', 'menu_order' => 'ASC' )
    );
    
    $query = new WP_Query( $args );
    /* Order Posts Alphabetically */
    function prefix_modify_query_order( $query ) {
      if ( $query->is_main_query() ) {
    
        $args =  array( 'post_date' => 'ASC' );
    
        $query->set( 'orderby', $args );
      }
    }
    add_action( 'pre_get_posts', 'prefix_modify_query_order' );

    Let me now if this does the trick!
    Kind Regards,
    Skandha

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Reversing the Order of Posts on Front Page’ is closed to new replies.