Sunday, June 6, 2010

How to create a custom post type in Wordpress 3.0

April 19, 2010 by admin · Leave a Comment 

Wordpress 2.9 currently have two types of articles: post and pages.

WordPress 3.0 comes with an important novelty: types of articles.

What is so special ?

Suppose you have a music industry news site. With this new organization you can have a section of Albums / disks kept separated from the News section. Or maybe a section with your artists. You cand do that with the following code:

[php]
<pre>$args = array(
        'label' => __('Discuri'),
        'singular_label' => __('Discuri'),
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'hierarchical' => false,
        'rewrite' => true,
        'query_var' => 'discuri',
        'supports' => array('title', 'thumbnail')
);
register_post_type( 'discuri' , $args );</pre>
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • Netvibes
  • Reddit
  • RSS
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Twitthis
  • Blogosphere News
  • email
  • LinkedIn
  • Linkter
  • Live
  • MyShare
  • MySpace
  • Ping.fm
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Related posts:

  1. Custom post types with custom taxonomies
  2. Wordpress 3.0: Query custom post types
  3. Custom css for article
  4. show most commented pages with images in Wordpress
  5. Wordpress 3.0: Custom author profiles

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

SEO Powered by Platinum SEO from Techblissonline