{"id":42781,"date":"2015-02-03T02:48:18","date_gmt":"2015-02-03T07:48:18","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=42781"},"modified":"2016-02-24T03:51:12","modified_gmt":"2016-02-24T08:51:12","slug":"wordpress-how-to-change-the-order-of-custom-posts-based-on-page-templates","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/wordpress-how-to-change-the-order-of-custom-posts-based-on-page-templates.html","title":{"rendered":"WordPress. How to change the order of custom posts (based on page templates)"},"content":{"rendered":"<p>\r\n<\/p>\r\n<p>This tutorial shows how to <strong>change the order of custom posts (based on page templates)<\/strong> in WordPress.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=UaOaqJTRNKQ?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to change the order of custom posts (based on page templates)<\/a><\/p>\r\n<p>In order to change the order of custom posts, you should perform the following:<\/p>\r\n<ol>\r\n<li>\r\n<p>Define the .php file responsible for the page template set to display custom posts using <a href=\"\/help\/developer-tools.html\" target=\"_blank\">Developer Tools<\/a>:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-2.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-2-300x168.png\" alt=\"WordPress.-How-to-change-the-order-of-custom-posts-(based-on-page-templates)-2\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-42787\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-2-300x168.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-2-150x84.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-2-1024x576.png 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-2.png 1280w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>This file is located on server in <strong>\/wp-content\/themes\/CherryFramework\/loop<\/strong> folder. Please copy the file into <strong>wp-content\/themes\/themeXXXXX<\/strong> directory on the server.<\/p>\r\n<\/li>\r\n<li>\r\n<p>In our case it is <strong>loop-testi.php<\/strong> file;<\/p>\r\n<\/li>\r\n<li>\r\n<p>Open you WordPress dashboard;<\/p>\r\n<\/li>\r\n<li>\r\n<p>Go to <strong>Appearance -> Editor<\/strong>;<\/p>\r\n<\/li>\r\n<li>\r\n<p>Select themeXXXXX files to edit (on the top right corner);<\/p>\r\n<\/li>\r\n<li>\r\n<p>Select desired file to edit;<\/p>\r\n<\/li>\r\n<li>\r\n<p>Find the following part of code:<\/p>\r\n<pre class=\"brush:php\"> $args = array( \r\n  'post_type'        =&gt; 'testi', \r\n  'showposts'        =&gt; 4, \r\n  'paged'            =&gt; $paged, \r\n  'suppress_filters' =&gt; $suppress_filters, \r\n  );<\/pre>\r\n<\/li>\r\n<li>\r\n<p>Add this code in order to add ordering by title:<\/p>\r\n<pre class=\"brush:php\">\r\n'orderby' =&gt; 'title',\r\n'order' =&gt; 'ASC' <\/pre>\r\n<\/li>\r\n<li>\r\n<p>Save changes:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-1.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-1-300x168.png\" alt=\"WordPress.-How-to-change-the-order-of-custom-posts-(based-on-page-templates)--1\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-42788\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-1-300x168.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-1-150x84.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-1-1024x576.png 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/WordPress.-How-to-change-the-order-of-custom-posts-based-on-page-templates-1.png 1280w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>You can find all details regarding the posts order following <a href=\"http:\/\/codex.wordpress.org\/Class_Reference\/WP_Query#Order_.26_Orderby_Parameters\" target=\"_blank\">this link<\/a>.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=UaOaqJTRNKQ?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to change the order of custom posts (based on page templates)<\/a><\/p>\r\n<\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to change the order of custom posts (based on page templates) in WordPress.<\/p>\n","protected":false},"author":60,"featured_media":43489,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[728],"tags":[789,857,592,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/42781"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=42781"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/42781\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/43489"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=42781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=42781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=42781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}