This tutorial shows how to change the order of custom posts (based on page templates) in WordPress.
In order to change the order of custom posts, you should perform the following:
Define the .php file responsible for the page template set to display custom posts using Developer Tools:
This file is located on server in /wp-content/themes/CherryFramework/loop folder. Please copy the file into wp-content/themes/themeXXXXX directory on the server.
In our case it is loop-testi.php file;
Open you WordPress dashboard;
Go to Appearance -> Editor;
Select themeXXXXX files to edit (on the top right corner);
Select desired file to edit;
Find the following part of code:
$args = array( 'post_type' => 'testi', 'showposts' => 4, 'paged' => $paged, 'suppress_filters' => $suppress_filters, );
Add this code in order to add ordering by title:
'orderby' => 'title', 'order' => 'ASC'
You can find all details regarding the posts order following this link.
Feel free to check the detailed video tutorial below: