Display posts in descending posted order

Asked
Active3 hr before
Viewed126 times

8 Answers

orderdescendingpostsdisplay
90%

Asking for help, clarification, or responding to other answers., 1 Ascending or descending? – fuxia ♦ Jan 1 '13 at 0:52 , Meta Discuss the workings and policies of this site ,Connect and share knowledge within a single location that is structured and easy to search.

To get the order you want, try adding the following to your args:

array('posts_per_page' => '-1', 'post_type' => 'coach-instructor', 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'ASC')
88%

Since this answer was written, Firebase has added a feature that allows ordering by any child or by value. So there are now four ways to order data: by key, by value, by priority, or by the value of any named child. See this blog post that introduces the new ordering capabilities.,Someone has pointed out that there are 2 ways to do this: ,Hope this answer will help all the devs out there who are struggling with this issue in Firebase.,Firebase: How to display a thread of items in reverse order with a limit for each request and an indicator for a "load more" button.

The simplest way to get the behavior you want is to also specify an always-decreasing priority when you add the item:

var ref = new Firebase('https://your.firebaseio.com/sell');
var item = ref.push();
item.setWithPriority(yourObject, 0 - Date.now());

You'll also have to retrieve the children differently:

fbl.child('sell').startAt().limitToLast(20).on('child_added', function(fbdata) {
   console.log(fbdata.exportVal());
})
load more v
72%

If you’ve been working with WordPress for some time now then you probably already know that there’s a plugin for (almost) everything. The Post Types Order plugin is a free solution that allows you to re-order WordPress blog posts by simply dragging and dropping them into place.,Do you have any questions about how to re-order WordPress blog posts? Let us know in the comments section below!,In a nutshell, WordPress orders blog posts in reverse chronological order. This basically means that how your posts appear on the front-end depends entirely on when you published them. This example sums it up well:,If you want to re-order blog posts without altering their timestamps then using the Post Types Order plugin is an ideal option.

To get started, login to an FTP client and open up the active theme’s functions.php file by navigating to /wp-content/themes/ACTIVE-THEME/ from the root directory. Next, open up the functions.php file in a text editor of your choice (raw text editor, like Notepad; not MS Word) and insert the following lines of code at the bottom:

function order_posts_by_title($query) {
   if ($query - > is_home() && $query - > is_main_query()) {
      $query - set('orderby', 'title');
      $query - set('order', 'ASC');
   }
}
add_action('pre_get_posts', 'order_posts_by_title');
65%

The Truth About Shared WordPress Web Hosting,Upon activation, you need to visit Settings » Post Types Order page to change plugin’s settings. ,Why is WordPress Free? What are the Costs? What is the Catch?,How to Choose the Best WordPress Hosting for Your Website

For example, take a look at this code snippet. It allows you to display posts in chronological order (older posts first).

//function to modify default WordPress query
function wpb_custom_query($query) {

   // Make sure we only modify the main query on the homepage	
   if ($query - > is_main_query() && !is_admin() && $query - > is_home()) {

      // Set parameters to modify the query
      $query - > set('orderby', 'date');
      $query - > set('order', 'DESC');
   }
}

// Hook our custom query function to the pre_get_posts 
add_action('pre_get_posts', 'wpb_custom_query');
load more v
75%

You can use [display-posts order=”ASC”] to show the posts in ascending order (oldest first). ,Hey guys, I’ve trawled the forum here (and general Googling), but can’t find an answer. I want to display all posts, but in the reverse (ascending) order. If I use the standard [display-posts], it shows all posts published in descending order (newest to oldest). I need the ability to show them from oldest to newest. Really appreciate your help!,Support » Plugin: Display Posts - Easy lists, grids, navigation, and more » Reverse order of posts?,The topic ‘Reverse order of posts?’ is closed to new replies.

Hey guys, I’ve trawled the forum here (and general Googling), but can’t find an answer. I want to display all posts, but in the reverse (ascending) order. If I use the standard [display-posts], it shows all posts published in descending order (newest to oldest). I need the ability to show them from oldest to newest. Really appreciate your help!

[display - posts]
40%

Any reason why the nerds at Word Press cannot give us a simple “sort choice to asc or desc”/,There are a lot of plugins available that enable you to change WordPress  post order. I tried a few of them and was genuinely impressed with their functionality and ease of use. Search for “post order plugin” in the WordPress plugin directory and choose one that fits your needs. I strongly recommend that you use a plugin to set your custom post order; unless you don’t like plugins!,Would you like more WordPress customization tips?  Leave a comment and let me know.,Update 12/2015: I’m no longer updating this post so I can’t guarantee compatibility with latest version of WordPress. Test on your Localhost first before implementing it on your live site!

I was creating a post type for our church’s small groups and found this to be really handy to default the “smallgroup” type to sort by title on both the front and back end and also to have the admin recognize it is sorting by title:


//set default front and back-end sort of custom post type
add_filter( 'pre_get_posts' , 'my_nssg_order' ); // Runs before the posts are fetched
function my_nssg_order( $query ) {
// Check query and alter only the query needed
//echo ''; print_r($query); echo '';
if ($query->query['post_type'] == 'smallgroup' && !isset($query->query['orderby'])) {
$query->set( 'orderby' , 'title' );
$query->set( 'order' , 'asc' );
//get the arrow to show up over title in admin
if (is_admin()) {
$_GET['orderby'] = 'title';
$_GET['order'] = 'asc';
}
} //if
} //my_nssg_order

//set default front and back-end sort of custom post type
add_filter('pre_get_posts', 'my_nssg_order'); // Runs before the posts are fetched
function my_nssg_order($query) {
   // Check query and alter only the query needed
   //echo ''; print_r($query); echo '';
   if ($query - > query['post_type'] == 'smallgroup' && !isset($query - > query['orderby'])) {
      $query - > set('orderby', 'title');
      $query - > set('order', 'asc');
      //get the arrow to show up over title in admin
      if (is_admin()) {
         $_GET['orderby'] = 'title';
         $_GET['order'] = 'asc';
      }
   } //if
} //my_nssg_order
22%

It currently has over 400,000 active installs with a 4.5 out of 5-star rating. You can download Post Types Order from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. After activating it click into “Post Types Order” under settings and you can enable the types of posts you want the reorder interface to show up on.,By far one of the easiest ways to reorder posts in WordPress is with a plugin. We highly recommend the free Post Types Order plugin. This allows you to reorder posts, pages, custom post types, and products (WooCommerce and EDD) using a drag and drop sortable JavaScript capability.,You could also hire a WordPress developer to create your own custom ordering query. ,Because the WordPress theme has custom styles in place for this custom post type rearranging them with the plugin allows us to control exactly how they are displayed on the page. So in a sense, reordering with this plugin can even affect your site’s design and feel.

Your last option would be to reorder posts in WordPress with custom code. Here is an example of sorting your posts on the frontend in ascending order by title. To make sure your customizations stay in place when updating your theme, start by making a backup of your site and creating a child theme. Then, place this in your theme’s functions.php file.

function change_posts_order($query) {
   if ($query - > is_home() && $query - > is_main_query()) {
      $query - > set('orderby', 'title');
      $query - > set('order', 'ASC');
   }
}
add_action('pre_get_posts', ' change_posts_order ');
60%

I'm trying to test out Firebase to allow users to post comments using push. I want to display the data I retrieve with the following;,Here's a link to the announcement: More querying capabilities in Firebase,The problem is the data is returned in order of oldest to newest - I want it in reversed order. Can Firebase do this?,Firebase supports retrieving child nodes of a collection in two ways:

I'm trying to test out Firebase to allow users to post comments using push. I want to display the data I retrieve with the following;

fbl.child('sell').limit(20).on("value", function(fbdata) {
         // handle data display here
      }
load more v

Other "order-descending" queries related to "Display posts in descending posted order"