Categories

Featured templates

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

Lana Greene February 3, 2015
Rating: 5.0/5. From 1 vote.
Please wait...

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)

Top Wordpress Themes
This entry was posted in WordPress Tutorials and tagged custom, order, post, WordPress. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket