Author: Mark Leong

Set WordPress custom post types order in admin

One of the long-awaited new features of WordPress 3.0 is custom post types.

By default, custom posts with the post capability_type (as opposed to page, attachment, revision, or nav-menu-item) are listed newest to oldest in the WordPress backend. This makes sense if these are blog posts, but if they are some other content type (such as quotes, movies, books or contacts) it is often desirable to have them listed alphabetically.

To achieve this, add the following code to your functions.php file, replacing POST_TYPE (line 7) with the name of the post type that you want to have listed alphabetically.

function set_custom_post_types_admin_order($wp_query) {
  if (is_admin()) {

    // Get the post type from the query
    $post_type = $wp_query->query['post_type'];

    if ( $post_type == 'POST_TYPE') {

      // 'orderby' value can be any column name
      $wp_query->set('orderby', 'title');

      // 'order' value can be ASC or DESC
      $wp_query->set('order', 'ASC');
add_filter('pre_get_posts', 'set_custom_post_types_admin_order');

New website launched: Kingsbridge Project

This week saw the launch of the Kingsbridge Project website that I’ve been working on with some friends from church.

Kingsbridge Project

The Kingsbridge Project is a consortium of faith groups, social enterprises, sports bodies and public bodies dedicated to bringing together communities in South Birmingham through sport and community activity. The initiative is currently in its early stages and the website is meant to serve its current needs of establishing a web presence and providing publicity. As a result I decided that instead of creating a custom design, I would use ‘PersonalPress’, a premium WordPress theme Elegant Themes, so that I could get site off the ground as quickly as possible.

Please let me know what you think by leaving a comment, thanks!

Import Facebook note comments into WordPress using Facebook CommentsTNG

Facebook allows you to quickly and easily import an external blog from another website. See the Facebook help pages if you want to find out how to do this.

This is great, but after a blog post had been imported as a note, Facebook users are likely to comment on it in Facebook. If you are using blogging with WordPress and want to have all your comments in one place, there is a WordPress plugin that can help you: Facebook CommentsTNG. It will automatically scan your Facebook notes for imported WordPress blog posts and bring the comments back into WordPress.

This is an excellent plugin which builds on the idea of the Facebook Comments plugin, which no longer works (probably due to changes in way Facebook notes are marked up).

Check out the author’s page for the plugin: Facebook CommentsTNG.