Monday, May 31, 2010

25 Excellent Ajax Techniques and Examples

Ajax allows for rich-internet applications that mimic the responsiveness and complex user interfaces typically associated with desktop applications. Moving applications to the web browser opens many possibilities, including the ability to save user data, connecting with other users for collaboration and sharing, and making deployment and using the application easier since web browsers are standard-issue with most computers regardless of operating system.

If you’re interested in expanding your understanding of Ajax techniques and practices, check out these 25 hand-picked Ajax articles and tutorials that outline various methods and concepts involved in the development of Ajax-based applications. Though most are geared for budding and intermediate developers, veterans might find a trick or two they haven’t encountered before.

1. Ajax RSS reader

Ajax RSS reader - Screenshot

Build a simple RSS reader that takes remote XML data from RSS feeds using Ajax, PHP, and MySQL. This example allows users to view feed content from multiple sources in one page. At the bottom of the article, you’ll find an animated demonstration of the RSS reader.

2. Ajax Desktop Tutorial

Ajax Desktop Tutorial - Screenshot

This tutorial is a step-by-step guide on how to create a desktop/homepage similar to Pageflake and Netvibes. The goal of this tutorial is to showcase some common techiques involved in developing web-based applications like manipulating the Document Object Model (DOM), listening to events (i.e. certain mouse movements), and working with remote data.

3. Ajax for Chat

Learn to build a simple web-based chat client using asynchronous JavaScript, XML, and PHP. The tutorial’s example utilizes the Prototype JS framework, MySQL, and PHP.

4. Create your own information space with Ajax and del.icio.us

This article outlines the basic foundations of using Ajax alongside an API service. It uses the del.icio.us API, but the methods and concepts can be adapted to other popular services such as Digg’s or Flickr’s. It’s an essential resource for those contemplating on creating web applications that use remote XML data – a couple of live examples are popurls and SocialBlade, which obtains information from social media sites using available API services. This tutorial requires you to register (for free).

5. Ultra-lightweight Charts For AJAX

Ultra-lightweight Charts For AJAX - Screenshot

See how to create a super-lightweight (1.78 KB) charting component using Flash with Ajax. The example allows you to generate visual graphs using dynamically-loaded data. The solution involves ActionScript-JavaScript communication, and covers the use of the setData and setStyle ActionScript methods for generating and styling the charts.

6. Quick Calendar Using AJAX and PHP

Quick Calendar Using AJAX and PHP - Screenshot

Learn how to create a calendar component using Ajax and PHP. Ajax is used for navigating through the calendar months without refreshing the page.

7. How to integrate Google Calendar in your website using AJAX

How to integrate Google Calendar in your website using AJAX -  Screenshot

This tutorial shows you how to create a web page component that calls a publicly available Google calendar. Google Calendar allows you to easily create, share, and manage events and is an excellent feature for community websites.

8. Edit In Place with AJAX Using jQuery

Edit In Place with AJAX Using jQuery - Screenshot

In this example, users are given the ability to edit the XHTML of the web page they’re currently viewing. The example is a proof-of-concept – presenting how this functionality can be achieved using jQuery. Normally, you’d want to send the user’s edits to server-side code to perform processes such as validation or saving the changes in a database.

9. Creating an AJAX Rating Widget

Creating an AJAX Rating Widget - Screenshot

Learn the concepts of creating a rating system without prompting the user to click a submit button or refreshing the page. The tutorial showcases how you can do this in a variety of ways by including examples for the following four JavaScript frameworks/libraries: Dojo, jQuery, mootools, and Prototype JS.

10. AJAX file upload tutorial

AJAX File Uploader - Screenshot

In this tutorial, you’re shown how to create a file uploader. The tutorial uses JavaScript and PHP.

11. Use AJAX and PHP to Build your Mailing List

This tutorial from SitePoint walks you through the development of a mailing list form that accepts submissions asynchronously. It uses MySQL for storing the data inputted by the user and Prototype JS for simplifying Ajax requests and binding event handlers.

12. Safer Contact Forms Without CAPTCHAs

Safer Contact Forms Without CAPTCHAs - Screenshot

One way to reduce spam from public web forms is to implement a system to verify if the submitter is human by using image CAPTCHAs. Problems arise with accessibility when individuals using visual assistive technologies are presented with the test (and thus cannot continue on). This simple technique uses an Ajax call to a server-side script to drop a cookie on the user’s computer.

13. Using AJAX with CAPTCHA

Using AJAX with CAPTCHA - Screenshot

Avoiding the use of image-based CAPTCHAs is a good idea. With that said, many sites still prefer using this technique to distinguish between humans and computers. If forgoing web accessibility is appropriate for your situation, this article outlines a unique method for administering CAPTCHA tests. The user is presented with a sequence of descriptions (i.e. Animal, Costume, Boy), and asked to click on a set of images in sequential order. The clicks are recorded and validated, returning the appropriate status message. Though probably not an ideal solution to CAPTCHAs, it does outline a fundamental technique for developing responsive user interfaces – use it for inspiration.

14. Ajax-based login form

Ajax-based login form demo - Screenshot

Create a basic login form that asynchronously validates the inputted data. The example uses the jQuery form plugin and PHP to process the request.

15. Nice Ajax effect for message box using Mootools

Nice Ajax Effects for messages - Screenshot

In this example, a message box that fades after a specified duration is displayed when the user clicks on the “save” button. This is a model for supplying users with the status of their request, and an real Ajax request should typically happen when the user clicks on the “save” button.

16. AutoCompleter Tutorial

AutoCompleter Tutorial - Screenshot

The AutoCompleter tutorial teaches you how auto completion of input fields can be accomplished. The example uses jQuery, PHP, and MySQL.

17. Auto-populating Select Boxes using jQuery & AJAX

Auto-populating Select Boxes using jQuery & AJAX - Screenshot

A key technique in Ajax applications is to populate content without a page refresh. In this tutorial, you’ll witness how this is done with a PHP and JavaScript (jQuery to make it easier).

18. Build an Ajax Dropdown Menu

Here’s a basic example of working with external data to load content into a drop-down menu – from our beloved Webmonkey. Though the example uses a text file, you can use your own data source when applying the technique to your own purposes.

19. Ajax/PHP Shoutbox Tutorial

Ajax Shoutbox - Screenshot

Make an Ajax-powered shoutbox using PHP and JavaScript. This tutorial walks you through the server-side and client-side requirements of creating a shoutbox, which can be adapted to other functions such as a commenting system.

20. Building Tabbed Content

Building Tabbed Content - Screenshot

Learn how to build a tabbed content component with the data populated via Ajax. The tutorial uses PHP and Prototype JS.

21. How to Load In and Animate Content with jQuery

Load In and Animate Content - Screenshot

This step-by-step tutorial shows you how to load data into a web page using jQuery to handle the Ajax request and manipulation of the DOM.

Best practices and workaround techniques to common issues

22. The Hows and Whys of Degradable Ajax

The Hows and Whys of Degradable Ajax - Screenshot

This article discusses the concept of creating Ajax-based applications that degrades effectively when JavaScript is not detected, providing increased accessibility and bulletproof-ness. Completely successful degradation means that an application is still usable and information is still accessible without reliance to JavaScript or CSS.

23. Avoid unnecessary Ajax traffic with session state

This article presents a method for minimizing unneeded database/computational processes and avoiding large status updates if no changes have occurred. By using client cookies to keep track of the session’s state, you can cut down on processes that may be redundant. Though the article presents an example using Python for server code – the model remains the same in virtually any language you use.

24. A Better Ajax Back Button Solution

Here’s a workaround to issues pertaining to Ajax-loaded content breaking web browser controls and bookmarking capabilities. The solution involves firing off a function at a set interval that checks the #value of the URL, and then presenting the correct content. It restores the ability to bookmark the content. In Part 2 of the article, you’ll see a working example and additional discussion of this method.

25. Making Ajax Work with Screen Readers

Making Ajax Work with Screen Readers - demonstration Screenshot

One of the biggest drawbacks of loading content via Ajax is that it fails to indicate an update of the content to users who are reliant on screen readers. For people who are not visually-impaired – messages and status indicators can be visual queues that the content is changing; this isn’t effective for users with visual impairments. This article draws out the underlying issues and proposes techniques to make Ajax-based applications work with screen readers.

There we have it… some brilliant Ajax techniques and examples. I hope you’ve found some links of interest that will help you in a future project or in advancing your command of Ajax.

Tuesday, May 25, 2010

20 Excellent Websites for Learning Ajax

Ajax (asynchronous JavaScript and XML) is a technology that allows for for highly-interactive and responsive browser-based applications. By leveraging the XMLHttpRequest object, seamless communication with the server can be achieved for a smooth and dynamic user experience.

If you’ve ever wanted to learn about Ajax, there are many sites out there that’ll help you "grok" Ajax and the various technologies surrounding it. Here are 20 top-notch websites that cover the subject of Ajax.

1. Ajax resource center (developerWorks)

Ajax resource center (developerWorks) - screen shot.

developerWorks, a resource center for developers and IT professionals by IBM, has a dedicated Ajax resource center that hosts plenty of tutorials on Ajax. developerWorks tutorials are in-depth and lengthy, and you can learn a variety of information and techniques from them such as creating RIA applications with jQuery and Ajax, learning about Ajax security tools, and building an Ajax-based chat system.

2. Mozilla Developer Center (AJAX)

Mozilla Developer Center (AJAX) - screen shot.

The Mozilla Developer Center has an AJAX section that’s a great starting point for beginning developers or those that need to brush up on Ajax. The Getting Started guide on MDN is an excellent starting point to learn about the basic concepts of Ajax. Another MDN guide you might be interested in reading is the entry on XMLHttpRequest, the primary mode of communicating with server-side scripts in typical Ajax approaches.

3. AJAX Today

AJAX Today - screen shot.

AJAX Today is a community-driven website where members can submit links on the topic of Ajax. AJAX Today organizes submitted links in useful categories such as AJAX Tutorials and Ajax Podcasts; you can subscribe to each individual category via RSS so that only topics that you’re interested in will be displayed in your RSS feed reader.

4. ajax.solutoire.com

ajax.solutoire.com - screen shot.

ajax.solutoire.com is a large, one-page directory-style listing of online Ajax resources created by Software Engineer, Bas Wenneker. ajax.solutoire.com is conveniently sub-divided into various categories such as Ajax news and Ajax/JavaScript security. Bas Wenneker also runs Solutoire.com, a personal weblog that talks about web development topics such as JavaScript and MooTools.

5. SitePoint: JavaScript & Ajax Tutorials

SitePoint: JavaScript & Ajax Tutorials - screen shot.

SitePoint, a web publication focused on providing web professionals useful and relevant information, has a JavaScript & Ajax Tutorials section that’s great for developers who learn well by reading practical tutorials. You can follow along (and learn from) tutorials such as "Use AJAX and PHP to Build your Mailing List" and "Take Command with Ajax".

6. Encosia

Encosia - screen shot.

Encosia is a blog by Dave Ward, who writes about the subject of web development (primarily ASP.NET and Ajax). Encosia has plenty of tutorials that discuss topics such as how to display data updates in real-time and how to use jQuery for interactively searching data. Encosia is an top-notch resource on Ajax – especially for developers working with ASP.NET as you can read ASP.NET/Ajax-specific articles like "Are you making these 3 common ASP.NET AJAX mistakes?".

7. Ajax Technology Center

Ajax Technology Center - screen shot.

The Ajax Technology Center is a part of the Adobe Developer Connection, a resource site for web developers and designers. The Ajax Technology Center provides handy articles and tutorials on topics such as Adobe AIR for Ajax developers and Adding Ajax components to Dreamweaver projects.

8. Ajax Blog

Ajax Blog - screen shot.

Ajax Blog is a weblog on the topic of Ajax. Ajax Blog has plenty of categories to help you quickly find specific information you’re looking for. If you’re searching for Ajax tutorials and examples, jump right to the Ajax Tutorials and Ajax Examples category.

9. AJAX Matters

AJAX Matters - screen shot.

AJAX Matters is a weblog on Ajax technology. Launched in 2004, AJAX Matters is one of the first blogs dedicated to discussing Ajax. They have plenty of helpful tutorials on matters like getting started with Ajax and PHP or learning about the Google Web Tookit

10. Ajaxonomy

Ajaxonomy - screen shot.

Ajaxonomy is a blog by a group of web developers whose intent is to share and discuss information on Ajax. If you’re seeking out Ajax tutorials, you can go directly to blog posts tagged with Tutorials where you’ll find an aggregate of posts that either share tricks and techniques related to Ajax technologies (such as server-side caching in PHP) or reviews of tutorials elsewhere on the web.

11. Ajaxian

Ajaxian - screen shot.

Ajaxian is the premier weblog dedicated to reporting new developments in Ajax. Ajaxian publishes a variety of regularly-updated Ajax topics, including a Tutorial topic which shares Ajax-related tips and tutorials. With a staff full of top web professionals in the field of web development, Ajaxian is a foremost resource for Ajax news and information.

12. Ajaxlines

Ajaxlines - screen shot.

Ajaxlines is a website that aims to provide its audience with Ajax-related news, resources, and tutorials. It reports on news and information from a wide variety of resources, and gives readers the opportunity to discover articles in one site.

13. AJAX Magazine

AJAX Magazine - screen shot.

AJAX Magazine, which is part of the PHP Magazine Network, is a webzine that covers the subject of Ajax. There’s a wide range of categories to help you find information that you’re interested in including an Ajax tutorials category that reports on useful Ajax tutorials and more specific categories like the Ajax and .NET category.

14. InsideRIA

InsideRIA - screen shot.

InsideRIA is an O’reilly Media community website on Rich Internet Applications (RIA for short). You will find a host of articles pertaining to building highly-interactive web applications such as writing your first YUI Application (YUI is Yahoo!’s JavaScript library), and Ajax Frameworks for High Traffic Sites. Check out articles tagged with ajax to conveniently find Ajax-specific topics.

15. AJAX Impact

AJAX Impact - screen shot.

AJAX Impact is committed to delivering information on Ajax. Check out the Ajax Tutorial section to find a list of tutorials on Ajax. If you’re curious on finding examples of websites (organized into types of websites) be sure to go to the "Sites Using Ajax" section on AJAX Impact.

16. AJAXwith.com

AJAXwith.com - screen shot.

AJAXwith.com is a community-driven site where you can submit resources on "Ajax with [fill in the blank]" (i.e. "Ajax with PHP"). They have an AJAX forum with close to 4,000 members which may be useful when you’re in need of help on a specific issue.

17. David Walsh Blog

David Walsh Blog - screen shot.

Web developer David Walsh provides useful tips and tutorials for all levels of web designers and developers on his personal blog, David Walsh Blog. He writes about a range of topics related to web development, and has an Ajax topic to help you speedily find articles that discuss Ajax. His tutorials on Ajax include "Ajax Username Availability Checker Using MooTools 1.2" and "Periodical Ajax Requests Using MooTools 1.2".

18. Ajax Projects

Ajax Projects - screen shot.

Ajax Projects is a directory-style listing of Ajax web projects. They have an excellent Tutorials section which lists plenty of Ajax-related tutorials from several resources such as "PHP ajax login form using Jquery", "Google Analytics: Tracking AJAX and Flash", and "How to structure your JavaScript code".

19. Agile Ajax

Agile Ajax - screen shot.

Agile Ajax is a section on Pathfinder Development (a software development and UX design company) that shares information on the topic of Ajax. Some posts you’ll see in Agile Ajax include "App Security: Throw Out the Org Chart!" and "Scriptaculous: Fixing Hover After Highlight".

20. Ajax Patterns

Ajax Patterns - screen shot.

Ajax Patterns is a wiki-style, community-driven website for Ajax information. If you’d like to see common Ajax design patterns, check out the Examples entry. Ajax Patterns also has a section on Ajax demos which showcases demonstrations of Ajax patterns (great for individuals who want to see practical applications of Ajax techniques).

Wednesday, May 19, 2010

WordPress 3.0: Ultimate Guide to New Features

Ultimate Guide to New Features of WordPress 3.0

WordPress 3.0 — the newest major version of WordPress — is one of the most highly-anticipated open source upgrades this year.

WordPress is no doubt one of the most used publishing platforms. Large websites such as Smashing Magazine, Mashable, TechCrunch, the site you’re on now, and others use it to run their high-traffic websites.

According to the timeline on WordPress trac, WordPress 3.0 should have been released on May 1, 2010, but now, the core developers of WordPress have removed the release date because of bugs that still needs to be fixed.

There are expectations that the production version will be released in the last week of May, 2010 or in the early start of June, 2010.

WordPress 3.0 has already made so much buzz because of some major and fresh features that innovate the publishing platform’s user interface.

In this article, to give you all a head start for the release, I will walk you through the notable new features of WordPress 3.0. For the discussion, I used the latest beta release, which you can download from here.

The best way to experience WordPress 3.0 is by installing it on your own computer (localhost) using this easy to follow guide so that you can follow along with me hands-on.

WordPress 3.0’s User Registration Interface for Installation

The new welcome screen got a big overhaul for better security and usability. It now has options for choosing a username and setting your own password.

Before, having the default username automatically generated as "admin" was a major security risk in all the previous releases of WordPress, especially for non-web-developer users and was bad from a usability standpoint. After finishing their WordPress install, users had to create a new username and then delete the default "admin" user for security against bruteforce hacking attacks.

That’s been resolved with WordPress 3.0’s new Welcome screen.

The New Welcome Screen

New User Registration Interface for Installation

WordPress 3.0’s New Default Theme: “2010″

The default Kubrick theme has been retired in WordPress 3.0 and removed from the installation package.

WordPress 3.0 will come bundled
with a new default theme called 2010 which will have built-in support for child themes, header customization and background
alterations
. The new theme also has built-in support for drop down menus.

This is a brilliant move from WordPress to give users a fresh new look when they launch their WordPress site.

The Auttomatic (the creators of WordPress) theme team will release a new default theme every year which will come bundled with WordPress. That’s the reason this theme is named 2010.

2010: The Default WordPress 3.0 Theme

A New Default Theme: "2010"

Header Customization in WordPress 3.0

Users can easily upload their own header backgrounds with this new WordPress 3.0 feature directly from the WordPress administration panel.

“2010″ comes with 8 beautiful header backgrounds (featured below). There is also an option for uploading your own custom headers.

Below is the screenshot of this new WordPress feature followed by a screenshot which is a result of my experimentation.

Header Panel in WordPress 3.0

WordPress 3.0 Headers

A Custom Header Made Using the Header Panel in WordPress 3.0

Custom Header Support in WordPress 3.0

If you want to add this functionality into your theme, then the code snippet below will do the trick. The 2010 WordPress 3.0 theme uses this snippet to enable support for custom header. You will have to use this snippet in functions.php of your WordPress theme to support the custom header functionality. Read the code comments for a walkthrough of what’s going on.

 // Your changeable header business starts here
define( 'HEADER_TEXTCOLOR', '' );
// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' );

// The height and width of your custom header. You can hook into the theme's own filters to change these values.
// Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.

define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );

// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit).

set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

// Don't support text inside the header image.
define( 'NO_HEADER_TEXT', true );

// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See twentyten_admin_header_style(), below.

add_custom_image_header( '', 'twentyten_admin_header_style' );

// ... and thus ends the changeable header business.

// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.

register_default_headers( array (
'berries' => array (
'url' => '%s/images/headers/berries.jpg',
'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
'description' => __( 'Berries', 'twentyten' )
),
'cherryblossom' => array (
'url' => '%s/images/headers/cherryblossoms.jpg',
'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
'description' => __( 'Cherry Blossoms', 'twentyten' )
),
'concave' => array (
'url' => '%s/images/headers/concave.jpg',
'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
'description' => __( 'Concave', 'twentyten' )
),
'fern' => array (
'url' => '%s/images/headers/fern.jpg',
'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
'description' => __( 'Fern', 'twentyten' )
),
'forestfloor' => array (
'url' => '%s/images/headers/forestfloor.jpg',
'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
'description' => __( 'Forest Floor', 'twentyten' )
),
'inkwell' => array (
'url' => '%s/images/headers/inkwell.jpg',
'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
'description' => __( 'Inkwell', 'twentyten' )
),
'path' => array (
'url' => '%s/images/headers/path.jpg',
'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
'description' => __( 'Path', 'twentyten' )
),
'sunset' => array (
'url' => '%s/images/headers/sunset.jpg',
'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
'description' => __( 'Sunset', 'twentyten' )
)
) );

WordPress 3.0 Background Customization

The 2010 WordPress 3.0 theme also permits users to change the background of posts and pages from the backend administration panel.

There are a lot of options such as the ability to choose different colors and uploading an image to set as your background.

Custom Background Panel

Custom Background support in WordPress 3.0

Adding custom background functionality in your own theme is pretty simple. Just add this one line of code in your theme’s functions.php file.

add_custom_background();

After that, users who have activated your theme will get a Background tab under the Appearance tab.

New Link Shortener

WordPress 3.0 offers better micro-blogging (e.g. Twitter) integration with its new feature called Shortlink, which gives you the ability to generate branded short links (in a similar way as is.gd or bit.ly) for sharing your posts and pages in social media.

New Short Links

WordPress 3.0’s Easy Navigation Menu Management

The exciting menu management feature is one of the most anticipated and demanded features of WordPress end-users.

This new feature will make it easy as pie for users to add new navigation menus in their WordPress-powered blogs and websites.

You will need no coding experience to modify your WordPress navigation: Just drag and drop menu items, and that’s it.

You can add outgoing links, categories and pages in one single menu just by using the navigation menu’s management feature. This is an insanely awesome and powerful feature to make WordPress site management all the more easier for WordPress users.

See how I made the navigation menu below.

Menus Panel (Features Drag and Drop)

WordPress 3.0's Easy Navigation Menu Management

The Result of Adding a Menu in My WordPress 3.0 Localhost Installation

WordPress 3.0's Easy Navigation Menu Management

In the 2010 WordPress 3.0 theme, the default menu gets replaced with the menu you create.

But you can create dedicated widget areas for placing navigation menus in the sidebar and other parts of your custom WordPress theme.

You can add support for this feature by adding this line in your theme’s functions.php file.

add_theme_support( 'nav-menus' );

After this line, you will be able to see the Menus tab under the Appearance tab. But in order to show your navigation menus in your WordPress theme, you will need to use the wp_nav_menu() WordPress theme function.

To give you an idea, the WordPress 3.0 2010 default theme uses this code snippet to show a custom menu in header.

wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) );

Support for Author Templates

Each Author in WordPress has an ID, just like categories and pages.

In WordPress 3.0, you will be able to design individual author templates. This feature can come handy on multi-author blogs like, for example, the site you’re on: Six Revisions.

Let’s use an example to illustrate how this new functionality works: I am an author (Saad Bassi) here at Six Revisions while Jacob Gube is the Chief Editor.

Let’s pretend Jacob created a custom author page for me, called author-saad.php.

With the new functionality, WordPress will first look for author-saad.php before author.php in the template files to render my page differently from the default author.php design.

The same method can be used to style Jacob’s author page, and hence, both of us will have different author templates. Pretty cool, right?

WordPress 3.0 Improves Content Management with Custom Post Types

Custom post types is another highly-demanded feature by WordPress theme developers. This feature will give them a lot of flexibility while using WordPress as a fully-featured content management system.

It will allow WordPress theme developers to create custom content types outside pages and posts. There were techniques to do this in the past, but not as robust and easy when compared to content management systems like Drupal.

In the following code snippet, I will add a custom “T-Shirts” content type tab in the WordPress backend by sticking this code snippet in my functions.php file.

function post_type_tshirt() {
register_post_type( 'tshirt', array( 'label' => __('T-Shirts'), 'public' => true, 'show_ui' => true ) );
register_taxonomy_for_object_type('post_tag', 'tshirt');
}
add_action('init', 'post_type_tshirt');

After adding this code, you should see the T-Shirts tab in the sidebar.

Custom Post Type called T-Shirts

WordPress 3.0 Improves Content Management with Custom Post Types

How do you retrieve these posts from your WordPress database? In the snippet below, I have called "post" and "tshirt" from the WordPress database with a little help from WordPress conditional tags.

add_filter( 'pre_get_posts', 'my_get_posts' );

function my_get_posts( $query ) {
if ( is_home() )
$query->set( 'post_type', array( 'post', 'tshirt' ) );
return $query;
}

WordPress 3.0’s Improved Custom Taxonomies

Custom taxonomies in WordPress is another feature which will help developers build powerful websites with less effort.

This feature is not new to WordPress 3.0; it was already available in WordPress 2.8. However, in WordPress 3.0, custom taxonomies get a revamping, loaded with new options and abilities.

With new enhancements, custom taxonomies become easier to use and allows for hierarchical relationships.

In the following snippet, I have created a new post type “jeans” with custom taxonomies of “Manufacturer” and “Style”.

function post_type_jeans() {
register_post_type(
'jeans',
array('label' => __('Jeans'),
'public' => true,
'show_ui' => true,
'supports' => array(
'post-thumbnails', //enable post thumbnails
'trackbacks', //enable Trackbacks
'comments') //enable Comments
)
);
// Here we add the custom taxonomy for Manufacturer like Levi's and Se7en. We are creating categories specific for this post type.
register_taxonomy( 'Manufacturer', 'jeans', array( 'hierarchical' => true, 'label' => __('Manufacturer') ) );

// Here goes the code for adding custom taxonomy for Style like "ankle jeans" and "baggy jeans".
// We are going to add tags specific for this post type.

register_taxonomy( 'style', 'jeans',
array(
'hierarchical' => true, // Enable or disable hierarchical structure
'label' => __('Styles'), // The Label to show in WordPress backend
'query_var' => 'style',
'rewrite' => array('slug' => 'style' ) // Slug to use in URLs
)
);
}
add_action('init', 'post_type_jeans');

Here is the result of the above code.

An Example Use of Custom Taxonomies in WordPress 3.0

above code

Multi-Site Feature with Only One WordPress 3.0 Installation

Another big update in WordPress 3.0 is the merging of WordPress MU – a fork of WordPress that lets the user create and manage hundreds of thousands of blogs with a single install of WordPress – and the plain-jane WordPress.

What this means in nutshell: You can create a number of websites using only one installation of WordPress.

Imagine that you’re a web developer who wants to build and host your client’s blogs and sites — you can run hundreds of client sites under one WordPress installation. If you have a scalable VPS, you can do all of this more reliably and affordably than ever before!

This feature is not enabled by default. You can enable multi-site functionalities by adding the following line to wp-config.php.

define('WP_ALLOW_MULTISITE', true);

After updating the file, you will get a tab of “Network” under the “Tools” menu as shown below.

The Network Panel in WordPress 3.0

Multi-site Feature

You can choose whether to use sub-domains or sub-directories for network websites.

Note: You can’t select between the two options on localhost (if you installed WordPress 3.0 during this walkthrough), so I suggest testing this feature on an actual server.

Final Thoughts on WordPress 3.0’s New Features

It’s evident from all these changes that WordPress is definitely going on the right path of becoming a fully-featured publishing platform.

There is always a room for improvement, but this extensive development in WordPress 3.0 shows the dedication of WordPress core developers and the WordPress community to the world’s most famous publishing platform.

If I were to encapsulate the new features in one statement, this is what I would say: It’s evident that WordPress development is focused on making things easier for WordPress developers when it comes to using WordPress for building multiple content management systems rather than just single-site blogs.

The second most prominent thing to note is that there are minor changes in the WordPress user interface that will help WordPress beginners and users that aren’t so technologically-savvy. For example, if you haven’t set up permalinks after a fresh WordPress installation, you will get a warning that links to the Permalinks administration panel right beneath each post and page title in the WordPress writing panel.

What do you think about WordPress 3.0? What exciting features does it offer you? How will these changes impact your development of websites and blogs? Please join the discussion in the comments!