If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

WordPress. How to change the order of custom posts (based on page templates)

This tutorial shows how to change the order of custom posts (based on page templates) in WordPress.

WordPress. How to change the order of custom posts (based on page templates)

In order to change the order of custom posts, you should perform the following:

  1. Define the .php file responsible for the page template set to display custom posts using Developer Tools:

    WordPress.-How-to-change-the-order-of-custom-posts-(based-on-page-templates)-2

  2. 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.

  3. In our case it is loop-testi.php file;

  4. Open you WordPress dashboard;

  5. Go to Appearance -> Editor;

  6. Select themeXXXXX files to edit (on the top right corner);

  7. Select desired file to edit;

  8. Find the following part of code:

     $args = array( 
      'post_type'        => 'testi', 
      'showposts'        => 4, 
      'paged'            => $paged, 
      'suppress_filters' => $suppress_filters, 
      );
  9. Add this code in order to add ordering by title:

    'orderby' => 'title',
    'order' => 'ASC' 
  10. Save changes:

    WordPress.-How-to-change-the-order-of-custom-posts-(based-on-page-templates)--1

  11. You can find all details regarding the posts order following this link.

Feel free to check the detailed video tutorial below:

WordPress. How to change the order of custom posts (based on page templates)