How to Customize WordPress Post Order?

Nur . Posted in How-To 2086 Views

For Blogger WordPress is the best choice for blogging. In WordPress theme every one wants to change Post order and page order in navigation menu or on home page, for that in this post I am going to show how to make these changes in Post order. Here are few ways to customize the sort order of posts in WordPress.

To customize post order manually, open your theme document and use the following code:

// display posts organized by title in ascending order
<?php $posts = query_posts( $query_string . '&orderby=title&order=asc' ); ?>
<?php if( $posts ) : ?>
	<div>
		<h1>Ordered by Post Title (Ascending)</h1>
		<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
			<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
			<p><?php the_content(); ?></p>
		<?php endforeach; ?>
	</div>
<?php endif; ?>

This code will display the specified number of posts in ascending order, according to post title. You can customized this code in countless ways according to your own requirements.

There is another useful post-ordering trick involves customizing the post order of, say, categories only, as one might do in an archive or service directory. To limit custom ordering to only categories, replace the first line of the previous loop example with this:
<?php if (is_category()) { $posts = query_posts( $query_string . ‘&orderby=title&order=asc’ ); } ?>
Also you can add another endif statement to the end of the loop like this:
<?php endif; ?>
<?php endif; ?>
As well you can  replace is_category() in that first line with the is_whatever() statement of your choice:

  • is_home()
  • is_single()
  • is_author()
  • is_search()
  • is_archive()

For more detail, check out the WordPress Codex.  let’s have a look  on to some easier custom-sorting methods by using WordPress Plugins.

1. Custom Query String Reloaded for WordPress 2.3 with tag support

Custom Query String Reloaded is one of the most commonly used WordPress plugins. Custom Query String (CQS) provides a Admin Options panel whereby users may specify any number of custom post queries. CQS enables custom sorting of many different types of queries.
Download | Custom Query String Reloaded

2. Smart Sort WordPress Plugin – Sort posts by Custom Field

This plugin allows you to place a sort bar, with options to sort the list of posts by any custom field. You can place the sort bar above or below a list of posts in a category or archive or anywhere in your template.

Download Smart Sort WordPress Plugin

3. aStickyPostOrderER : Plugin To Change WordPress Post Order

If you’d like to re-arrange the order that WordPress displays posts this plugin might help.
With aStickyPostOrderER you can customize the order of appearance of posts per category, per tag – or over-all – in a WordPress (versions 2.3+) blog. Useful for using WordPress as a Content Management System (C.M.S.).

Download AStickyPostOrderER

4. WP-Snap! WordPress Plugin

WP-SNAP! WordPress Plugin creates an alphabetical listing of ABCDEF, etc. links on a category template file. When you click “A”, “D”, or “Z”, any post titles that begin with that letter are showcased.

Download WP-Snap

5. Sort Category Posts by Title

This plugin looks like a quick and easy way of sorting category posts in ascending alphabetical order according to post title. According to the plugin’s homepage, “WordPress Sort Category Posts By Title” was designed for WordPress 2.0.2 and only customizes the sort order of posts displayed in category view — it will not effect the ordering of posts seen elsewhere (e.g., the home page) in the site. The code for this plugin seems clean, simple, and just begging for further exploration and adaptation ;)

Download Sort Category Posts By Title

Reference Resources:

30+ Essential WordPress Plugins
How to show Category ID for WordPress
List Posts by Category In Navigation
6 Ways to Customize WordPress Post Order
How to change page and category order in navigation menu of thesis theme?
WP-SNAP WordPress Plugin: Alphabetized Index Listing of Posts for Category Pages

Nur

I am a Wordpress, Website Developer and Designer, creator @ WP Arena, Provide Free WordPress consultation and can help to install WordPress in a secure way to small businesses and bloggers.

Free & Professional WordPress Security Service Free & Professional WordPress Security Service

We Love WordPress. WordPress Arena is a place for WordPress Developers and Designers, providing Tips, tricks, tools and resources to build a website or blog on WordPress. We also present The WordPress Showcase for all kind of WordPress Powered Websites.


Copyright © 2014 WP Arena All Rights Reserved

Divi WordPress Theme