First Impressions of Custom Post Type

One of the new very interesting things in WordPress 3.0 are individual post-types you can implement with little effort. Back then, you had to expand the database and write your own interface for it, now you just have to add a few lines of code - of course this is just the current state, which can be change until the final release.

After Justin had been playing with these types, we check out the possibilities of types for "Movies".

Simple Solution

function post_type_movies() {
	register_post_type( 'movies',
                array( 'label' => __('Movies'), 'public' => true, 'show_ui' => true ) );
	register_taxonomy_for_object_type('post_tag', 'movies');
}
add_action('init', 'post_type_movies');

default custom post type

More parameters for meta-boxes

Of course there are a number of parameters for this function and so the behavior and appearance of the corresponding edit page can be controlled quite easily, a small sample with additional meta boxes:

function post_type_movies() {
	register_post_type(
                     'movies', 
                     array('label' => __('Movies'), 
                             'public' => true, 
                             'show_ui' => true,
                             'supports' => array(
                                        'post-thumbnails',
                                        'excerpts',
                                        'trackbacks',
                                        'custom-fields',
                                        'comments',
                                        'revisions')
                                ) 
                      );
	register_taxonomy_for_object_type('post_tag', 'movies');
}
add_action('init', 'post_type_movies');

The default arguments

// Args prefixed with an underscore are reserved for internal use.
$defaults = array(
    'label' => false,
    'publicly_queryable' => null,
    'exclude_from_search' => null,
    '_builtin' => false,
    '_edit_link' => 'post.php?post=%d',
    'capability_type' => 'post',
    'hierarchical' => false,
    'public' => false,
    'rewrite' => true,
    'query_var' => true,
    'supports' => array(),
    'register_meta_box_cb' => null,
    'taxonomies' => array(),
    'show_ui' => null
);
  • label - A descriptive name for the post type marked for translation. Defaults to $post_type
  • public - Whether posts of this type should be shown in the admin UI. Defaults to false
  • exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public
  • publicly_queryable - Whether post_type queries can be performed from the front page. Defaults to whatever public is set as
  • show_ui - Whether to generate a default UI for managing this post type. Defaults to true if the type is public, false if the type is not public
  • inherit_type - The post type from which to inherit the edit link and capability type. Defaults to none
  • capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post"
  • edit_cap - The capability that controls editing a particular object of this post type. Defaults to "edit_$capability_type" (edit_post)
  • edit_type_cap - The capability that controls editing objects of this post type as a class. Defaults to "edit_ . $capability_type . s" (edit_posts)
  • edit_others_cap - The capability that controls editing objects of this post type that are owned by other users. Defaults to "edit_others_ . $capability_type . s" (edit_others_posts)
  • edit_others_cap - The capability that controls publishing objects of this post type. Defaults to "publish_ . $capability_type . s" (publish_posts)
  • read_cap - The capability that controls reading a particular object of this post type. Defaults to "read_$capability_type" (read_post)
  • delete_cap - The capability that controls deleting a particular object of this post type. Defaults to "delete_$capability_type" (delete_post)
  • hierarchical - Whether the post type is hierarchical. Defaults to false
  • supports - An alias for calling add_post_type_support() directly. See add_post_type_support() for Documentation. Defaults to none
  • register_meta_box_cb - Provide a callback function that will be called when setting up the meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback
  • taxonomies - An array of taxonomy identifiers that will be registered for the post type. Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type()

Including Custom Taxonomies

In the following example we include in our Post-Type a Taxonomy with two possibilities; own Tags and categories for Post-Type Movies, the classical tag, without hierarchy and one as category, tag with hierarchies.

function post_type_movies() {
	register_post_type(
                'movies', 
                array(
                        'label' => __('Movies'),
                        'public' => true,
                        'show_ui' => true,
                        'supports' => array(
                                     'post-thumbnails',
                                     'excerpts',
                                     'trackbacks',
                                     'custom-fields',
                                     'comments',
                                     'revisions')
                )
        );
	
	register_taxonomy( 'actor', 'movies', array( 'hierarchical' => true, 'label' => __('Actor') ) ); 
	
        register_taxonomy( 'production', 'movies',
		array(
                         'hierarchical' => false,
			 'label' => __('Production'),
			 'query_var' => 'production',
			 'rewrite' => array('slug' => 'production' )
		)
	);
}
add_action('init', 'post_type_movies');

Definitely a very interesting and useful feature which provides many possibilities to play around with.

Comments are closed.

112 comments

  1. Taylor Dewey

    Yet another step toward a very robust system -- this would definitely come in handy (and still may) on a client site I just finished.

    Thanks for the write-up, I was wondering how custom post types were going to work in 3.0

  2. Kris H

    Pure Awesomness

    I've been wanting this for a VERY long time. Had a quick play with it and it's going to make life sooooooooo much easier.

    I think WordPress can now call itself a CMS. Instead of a blog you hack into a hard to manage CMS.

  3. Dian

    Well it was about time for this feature.

    We already have a client website based on 2.7 which uses a custom post type, but we had to pay a developer do it.

    I wish this feature came earlier.

    But we better get it later rather than never!

    Yeah!

  4. Ozh

    That's a killer post.

  5. John

    This looks totally sweet. A quick search of 3.0 trunk source doesn't show an obvious way to filter out posts of a particular type in get_posts(), not like category__in or tag__in and their ilk. How would I request only the posts within a particular user-defined taxonomy with get_posts()?

  6. Mac_Boy

    @Frank, thanks for the explanation of each parameter. I too have been following and learning from Justin Tadlock's articles on custom post types and taxonomies.

    Since you've done a terrific writeup, would you please insert this info into the official WordPress documentation (codex)? (Unless its already in there)

    I've always said that WPengineer tackles the difficult stuff and avoids mimicing the other WP sites. Proved me right again.

    Thanks!

  7. Wes Bos

    Looking really interesting - I'd love to lose the hacky flutter/magic fields plugins.

  8. Michael

    Thanks Ozh!

  9. Oliver Schlöbe

    A very very cool wrapup of the Custom Post Type thingy, Frank. I've been coming across many question marks on Twitter these days, this post clarifies pretty much all. :)

  10. Dalton

    This is a killer feature for WordPress, I've been waiting for it for a long, long time. Thanks for the write up.

  11. matt mcinvale

    i am soooooooooooooooooooooooo excited for this feature! :):):)

  12. Frank

    @Mac_Boy: I think we will wait for a post on the codex; maybe it changes little bid until the final release.

    Thanks to all for your nice replies.

  13. Guillermo

    @John: I have tried using query_posts() and it works really fine. In this example, you can try something like:
    query_posts('post_type=movies')
    and you'll get a query of all the posts in Movie content type.

  14. Chris Robinson

    Great post, looking like a powerful new feature. Looking forward to 3.0

  15. Lucian

    Those are some very good news for WordPress community. I wanted this ability since I first got into WordPress.

    Thanks to keep the rest of us updated!

  16. Dian

    Once again, a step closer to the ultimate CMS!

  17. Nathan

    Amazing post! This is the feature I'm looking forward to the most in 3.0 and I am testing it out now with the nightly build.

    Thanks!!

  18. shawn

    Finally! wow this is the final missing piece for me. Man I just wish 3.0 was closer to release.

    What is funny, is just 3 hours ago I was on skype with custom developers and the quotes I received to do this in 2.9 were huge. 3.0 is literally going to save me thousands in development costs. No longer will I regret using wpmu instead of drupal... way to go wp!

    I absolutely love your website as indeed you do tackle the more difficult aspects of wp. Most other blogs are just rehashes of the basics. I learn more coming here for a few minutes than surfing tons of other wp 'code' sites.

  19. J

    A big thanks for this write up. Custom posts + custom taxonomies + open data is a huge game changer.

    The possibilities are endless and it pains me to think of all the potentially great projects we'll have to pass up.

  20. Tom Hermans

    This looks really promising. I'm using the pods-cms plugin now, which I'll probably be using still then cause of the handy cross-referencing, but this is a giant step forward.

    If they now could make a better user control system (assign users not only certain permissions, but also limit their actions to certain pages/posts/...).

  21. kingofpunk

    If we create 2 kind of posts types say : Directors and Movies.
    Can we make directors pages parents of movies pages ?

  22. Ova

    Hi, I am a newer in WP, and I don't know where to write this lines of code, to create individual post-types. Thanks.

  23. Tommy

    Wow, I've been using the Magic Fields plugin to do this on my Blu-ray site, this will be amazing when it's native in WP!

  24. Pixcod

    This is a good write up, I've used PODs before, which was great - but in all honesty I'd prefer this method even though I'm a novice PHP person. Speaking of being novice; when I integrated the supplied code (even the first snippet) I did not see anything change on the Admin side.

    Any thoughts?

  25. Kris H

    Pixcod - You need to download the latest nightly build of WordPress 3.0 (not recommended for live sites)

  26. palPalani

    This is the feature I'm looking forward to the most in 3.0. thanks for sharing this great idea!

  27. alex

    <3 wowwwww!!

    I ve being waiting for this hack for more than 2 years!

  28. Flick

    This feature looks fantastic! The thought of being able to modify the post interface to suit the post type is very exciting.

  29. Jan Egbert

    If anyone is interested in experimenting with custom post types, try CMS Press. A new plugin that provides an interface for adding post types and taxonomies. It's still in beta, but the guy working on it has also done some work on the custom post types feature for WordPress.

    http://github.com/voceconnect/cms-press

  30. Iva

    YAY, AT LAST! I'm excited and this is a great write-up that continues exactly where it should - on Justin's last year post.

    By the way, why can't I enlarge your screencaps? I want to see what I'm going to play with before I start playing with it. on the alpha.

    Also props to Jan Egbert, this looks interesting.

  31. Lars Bachmann

    Weehh.. That looks great. I can see a lot of possibilities with custom post types all ready. Can't wait to get my hands on WP 3.0 :)

  32. Idealien

    YES!!!!

    Must get a copy to start playing with it to see how we can take advantage of this through templates to match post types. I've been using More Fields for this type of thing in many of my sites thus far but it has its' shortcomings.

  33. Iva

    How would I go about having a specific template file for a specific post type? In other words, what to do if I don't want them to be listed in a specific way and, once one is selected, for that one to be displayed in a specific way (e.g. no date, no author info and definitely no posts' categories)? Or is it too early to even ask anything like this?

  34. JohnONolan

    Awesome post - really cool to see this new feature in action!

    @Dian - You should have researched more carefully then, there have been several plugins around for a number of years that have added this type of functionality. No custom development work needed!

    PS. A blog dedicated to WP, but no inline comments? That's a little strange!

  35. shawn

    check out the new plugin:
    http://wordpress.org/extend/plugins/verve-meta-boxes/

    This is a huge step forward for creating groups of meta boxes. I absolutely love the plugin, and would love to see it extended to work with 3.0.

    The one thing it does not do at the moment, is assign a meta box to a given post_type.

    This means if I create multiple meta boxes, they all show up on the post page, where if the plugin could be moded to 'attach meta boxes' to a given post_type, then we finally have the perfect wysiwig input area...

    just an idea....

  36. Nico

    @shawn : you are right. Verve Meta Boxes is the perfect addition to the custom types.

    In real life condition, creating new custom types (with custom taxonomies) but without new per type meta-field-boxes makes no sense.

  37. Kris H

    At the moment I use custom field template. And he is working to support custom post types :)

    http://wordpress.org/extend/plugins/custom-field-template/

  38. slee

    Excellent post, I cannot wait to get this it will very useful. It will make it even easier for a client to understand how to add news for example and easy for us to style.

  39. timani

    I program in both Drupal and WordPress, and for me one of the gripes i have had on the WP side was the lack of functionality and the ability to have dynamic content types and more "programmer" oriented tools, functionality and plugins.

    As of late this has changes a lot, this is definitely a step in the right direction. The ability to define custom content types if pivotal for any true CMS. Especially if you see how most modules on drupal such as with the powerful ubercart module extend the default node content type.

    I am sure soon there will be something to rival the views module for Drupal, but this alone is awesome and will likely change the way that A LOT of the current plugins that exists are coded in WordPress and rightly so.

    I am definitely going to take advantage of this, and i think this could be the step that will shake the misplaced title of WP as just a "blogging platform" to a true "CMS"

  40. Idealien

    @timani - That makes me wonder something wonderful and weird. Where / how will amazing custom content types be shared similar to what the plugin and theme repositories offer?

    Small snippet examples that could become plugins often just get documented as WordPress tutorials on blogs and wonderful sites like wpengineer.com and wprecipes.com. I could see logical arguments that nothing new needs to exist and they would just become part of a plugin, a theme or both.

    This might be a little longer-term question to see if some automated method for custom content types to be added to an installation similar to the automatic update makes sense. I have the same thought for widgets which seem to have fallen into both plugin and theme collections depending on their purpose.

  41. shawn

    I'm working on a client project as I write this, and one thing I cannot find about wp 3.0 is if it has the capability of assigning custom meta boxes to a post_type.

    I created a custom post_type in wp, and assigned taxonomies to it. That part works perfectly even in 2.9.2.

    What I can't figure out is how to add in the needed input fields such as image/file upload/etc to the post_type.

    I've tried the verve meta box plugin which works great, however it only allows me to assign a meta box to either a 'post or page' and does not recognize my new post_type as an option to assign the box to.

    Does wp 3.0 take away the need for verve, where I can add in not only taxonomies but custom meta boxes?

    (I know that i can use custom fields, but that is very unfriendly for my site admins, their tech level is >1, and they need a gui).

    What do you think would be the best way to proceed on this?

    --alternately if someone with enough skills took a look at verve, it may be possible to remove the hardcoded post types and have it look for all available ones to assign the box to.. that would be a dream!

    I'm currently using the cms-press plugin to create post_types with taxonomies, and that works awesome. Now just to combine the two plugins.. heaven

  42. illimar

    Hi! What a great post! I'm trying ut custom post types right now and I have a few questions:

    1. Can I somehow translate the post label? I tried adding using __(), but it doesn't seem to work - it only dispplays the english version of the text

    2. How can I change or remove the new post type slug? Ie, now i have something like gearhead.ee/equipment/bassikolar-turbosound-tq-425dp/ but I'd like to use gearhead.ee/bassikolar-turbosound-tq-425dp/ instead.

  43. fb

    Well done, just working on custom post types myself for a new project and your post along with Tadlocks, helps tremendously. Combine this with the new custom menus and we definitely will be saving ourselves a lot of hacking about in future sites that we build for clients.

    Keep up the good work

  44. Ash Blue

    This really gets me excited, I'm designing a church for a website and I'll now be able to create sections like events, news, and other cool things, It will make their lives a lot easier.

  45. Nicolas

    It is now required to register supports for the "title" and "editor" if you need them.

  46. Michael

    @Nicolas: no :)

  47. Konstantin

    You might want to add the singular_label parameter so that it would say 'Add Movie' but 'Movies' in the menu ;)

    Great post!

  48. matt mcinvale

    @Michael, it looks like Nicolas is correct. I was getting a mostly blank page and then adding title & editor to the supports array fixed it.

    What is the option to get the slug to display?

  49. matt mcinvale

    disregard: looks like the slug is auto-displayed with the title.

  50. Michael

    @matt @Nicolas: that snippet brings me a full testpost ui:

    register_post_type(
    'testpost',
    array(
    'label' => Testpost,
    'public' => true,
    'show_ui' => true,
    'exclude_from_search' => true,
    'supports' => array(
    'post-thumbnails',
    'custom-fields')
    )
    );

    Newer as this article is the singular_label.

  51. matt mcinvale

    And you're using the latest build? That's very bizarre. Without those options neither are displayed for me.

  52. Michael

    matt, just updated with 13753, same shit. Just custum_flieds ui ;)

    'supports' => array(
    'post-thumbnails',
    'custom-fields',
    'editor',
    'title'
    )

    That works now.

  53. Michael

    That was changed:

    if ( ! empty($args->supports) ) {
    add_post_type_support($post_type, $args->supports);
    unset($args->supports);
    }...

    And post-thumnails support dosn't work anymore. No clue why.

  54. matt mcinvale

    Heh, gotta love the Alpha stuff. ;)

    You wouldn't happen to know where they have docs on this stuff? Specifically looking to assign a template to a post type.

  55. Matthew

    @Michael try
    'thumbnail'
    instead of
    'post-thumbnails' , it works for me.

  56. Pablo Almeida, consultor de SEO

    Even as a beginning, it's too little to compete with Drupal and Joomla... :(

    I still want to use the Pods CMS. The Automatic could rely on this plugin to develop custom types module.

  57. Frank Anthony

    How do you move posts from one post type to another?

    Or, more specifically, how do you move an old post to a new post type?

  58. radiaku

    Hey, can we adding some nice custom write panel only on that post type.

    like on this.
    http://wefunction.com/2009/10/revisited-creating-custom-write-panels-in-wordpress/

    Any hack :P

  59. Xevo

    Would be awesome to see TDO Mini Forms to use this feature quick, that way we can make wikies etc. :)

  60. Leon Poole

    Custom fields will really open up WordPress to make it easier to do more 'complicated' and 'custom' websites with the CMS - I'm testing this out currently too.

    Would love to see more posts/examples/demo's on Custom Taxonomies :)

  61. Peter Ng

    @radiaku for the custom write panels all you gotta do is change the 4th parameter of the add_meta_box function ($page) to the name of your custom post. in this case you would change it to 'movies'.
    http://codex.wordpress.org/Function_Reference/add_meta_box

  62. Denis

    What should I do to show blog custom post types from users on my network (MU)?

  63. kingmagicl

    This is a feature of wordpress. It's is very good but this article writes error. Coding error syntax. You should write :
    function post_type_movies() {
    register_post_type(
    'movies',
    array('label' => __('Movies'),
    'public' => true,
    'show_ui' => true,
    'supports' => array(
    'excerpt',
    'trackbacks',
    'custom-fields',
    'editor',
    'title'
    )
    )
    );
    register_taxonomy_for_object_type('post_tag', 'movies');
    }
    add_action('init', 'post_type_movies');

  64. Jessica

    Shouldn't register_post_type() work in 2.9? The Codex lists register_post_type() as "Since 2.9."
    http://codex.wordpress.org/Function_Reference/register_post_type

  65. Gavin Hall

    This is great. Tried putting a few of these samples into functions.php file of latest 3.0 build but admin menu wouldnt show up as on your screenshots. Is this an extra step?

  66. Lars

    Great info. I can't wait to try this out. I've got WP 3.0 beta installed locally but haven't got around to testing the custom post type yet.

    After reading this I'll have to give it a go...eagerly anticipating more useful functions, code snippets and plugins to take advantage of this.

    I've been waiting for something like this for ages to be able to create a usable admin allowing users to add custom post types. Using custom fields was always too fiddly and unintuitive for novice users.

    I also tried using Flutter and Pods CMS but as powerful as they were never user friendly enough to use for client websites or for user contributed content on sites. Hopefully custom post types will give us the flexibility to finally create usable CRUD interfaces for external users.

  67. yeswework

    this functionality is of course very welcome, but the policy of having custom post types defined within functions.php makes no sense. these definitions aren't so much a part of a site's theme as a part of its underlying content/database.

    surely custom post-type definitions (and likewise custom taxonomies) ought to be in a separate theme-independent module, allowing the user to change theme but maintain the site's content and hierarchy?

    moreover: isn't it wasteful to have these definitions as PHP code which executes repeatedly and redundantly every time a page request is made?

    one more potential drawback of this method: if you started changing the post_type definitions once a site was already populated with data, you could quickly lose touch with the contents of the underlying database, with no way of cleaning it up or getting back to where you were.

    in my view these features should be configurable either through a GUI in the WordPress admin, or through YAML (or similar) but away from anything to do with the theme.

    any comments? have I missed something?

  68. KmaN

    I'm glad I read the comments all the way down as the last comment I read by @yeswework opened my eyes to what most of us seem to have been blind about.

    You bring up valid points @yeswework... and I'm interested to see what others may respond to this, including @Frank.

    Nonetheless, I am excited about this feature and I look forward to messing around with it with my fresh installation of WP 3.0.2 beta.

    Cheers.

  69. Richard Sweeney

    Thanks for a great article! This whole custom posts malarkey is really exciting.

    Here a question: If I create a custom post, how can I filter my query to a specific category?

    Let's say a create a custom post type called 'Music' and I create 2 categories : 'jazz' and 'classical'. How can I only display the 'jazz' entries?

    register_taxonomy( 'categories', 'music', array( 'hierarchical' => true, 'label' => __('Categories'), 'query_var' => 'cats' ) );

  70. Frank Anthony

    @Richard Sweeny : Just add 'post_type' to your query.

    $jazz = new WP_Query(array('post_type' => 'Music', 'category_name' => 'jazz'));
    while ($jazz->have_posts()) : $jazz->the_post();
    ?>

    // display post stuff here

  71. donalyza

    Anyone knows how to exclude a category in a featured post? I'm trying to exclude 'misc' cat. I only know how to exclude a post.

    Here's my code
    array('post', 'portfolio'), 'showposts' => 3 )); ?>

    Any help will be greatly appreciated. Thanks.

  72. Frank

    query_posts('cat=-2') exclude the categegory with ID 2.

  73. Damian

    If I create a custom post, how can I filter my query to a specific category?

    Let's say a create a custom post type called 'Music' and I create 3 categories : 'jazz', 'classical' and rock. How can I only display the 'jazz' and 'rock' entries??

    HELP

  74. JanvierDesigns

    I knew right away that going the wordpress way I couldn't go wrong! Ok. . .this post just gave me some sensation one has only after taking in a few substances! Wow .. . . Right now I am working on a client's website and we need to use "special types of posts " (Events to be specific) and this could come in so handy.

    WordPress team = I don't know... no words... Love you guys!

  75. Mike

    How is it possible to add the categories box to the custom post type? This doesn't show up by default like it does with regular posts. I have added the categories field to my custom post type menu and they are all displayed as uncategorized which tells me by default unless you select a category it goes uncategorized. How do I add the categories box so I can select a specific category for a custom post? For example a featured category so that if category = featured I can show featured posts.

  76. Adam Hansen

    I am using the code the_author_posts_link and it is not working for a custom post type I setup. I have authors posting normal posts and also this custom post type (photos). I made sure to set photos as a post type and not page. When clicking the link though it does not return any of the custom posts types. How can I set that up correctly?

  77. Christopher Hertz

    Quick heads up that with the WP Easy Post Types plugin you can create WordPress custom post types on the fly with an easy to use interface. Then manage custom fields and categories for your post types.

    It is a fairly powerful plugin. For example, you can create custom fields without having to create keynames and values. Output custom types simply by using the preformatted template tag for your field or create your own. One single call to display any field in an output. Additionally, once you have created a custom field this field is now available every time you edit/create a custom post type. This feature saves you time and gets rid of the frustration associated with custom fields that cause many people not to use them. Many out of the box field types available, or create your own through the plugin API.

    You can download it at wordpress.org or learn more about it at http://www.wpeasyposttypes.com.

  78. Nico

    I wrote a message on wordpress forums, about custom post types UI plugins.
    It's a first step of a benchmark of available solutions.

    Check it out : http://wordpress.org/support/topic/414967

  79. Leon

    For some setups you have to add the function

    flush_rewrite_rules( )

    otherwise it couldn't find the post

    thanks for nice post!

  80. Erik

    What about using plug ins with custom post types? Apparently this was never thought about during the development process. I mean I love the idea of creating a custom post type for podcast or screencast but if I can't use the plug ins I already have in place to handle the media of those type why in the world would I still create a custom post type ?

    Is there a solution for adding plug in meta boxes to custom post type that any one has heard of?

  81. Gaston Suarez Duek

    Is there any way to use page attributes in custom post types, I have order attribute, but I need Parent attribute, please help, Don't know if its possible!

  82. byronyasgur

    question: does register_post_type need to be called from add_action(init or is there another one - i want to use a form to register a custom post type - any ideas

  83. Agus Suhanto

    Do you know how to add custom fields automatically when registering custom type?

  84. byronyasgur

    thought i'd answer my own question as i just came across it and had figured it out ---- register_post_type needs to "register the post type" every init and so does have to be called from init ( the only way to use a form to register a custom post type is to save the form output to the database and then call a function on init to see if the data is in the (options) table and if it is then register_post_type

    @yeswework. i love the new technology but you are giving me something to think about --- although obviuouly plugins can register post types too and i think themes should be able to "generalte" their own post types but i think that admins should be able to register post types in the backend

  85. byronyasgur

    @Gaston Suarez Duek is it not set when you set up the array to do the register_post_type ?

    $..... = array(
    'hierarchical' => true,

    to be honest i could be wrong but i'm nearly sure its's somewhere down that road anyway - yes i definitely got a post type to allow parents/children definition in the posts and then turned it off somehow ... think it was the above

  86. khaledhakim

    I'm having a problem with Custom Post Type Categories...

    Setting the scene:
    lets say I have a custom post type of Books... and inside that custom post type I have created categories... Let's say I have categories A B and C.

    What I want:
    Display on the home page, or any other page for that matter, listings (posts) in a particular category of a specific Custom Post Type.

    Question:
    How can I call on the, say home page, all posts of custom type Books in category A only?...

    Been looking all over for the answer to this and have found none. Look forward for some help ... anyone ? :)

  87. Nico

    @khaledhakim :

    Let's say, your custom type post slug is "book", and your custom taxonomy slug is "book_category" and that you only want books from the category "philosophy" :

    query_posts('post_type=book&book_category=philosophy');

    //The Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    ..
    endwhile; else:
    ..
    endif;

  88. Matt

    Is there a way to add custom fields to the custom taxonomies?

  89. Rocky

    @Matt (comment 88) -- I think the answer to that is no. Can you describe more what you are trying to accomplish? Because I think adding custom fields to a custom post type instead of a custom taxonomy is probably what you should be doing.

    To a previous question regarding where to do all this registering, it makes more sense to create it in a plugin rather than in the theme's functions.php file. I'm working on a video plugin to create a video sitemap and another plugin to adapt the Open Video Project code to read video data from the video sitemap so a video gallery can be created. Creating a custom Video post-type was easiest right in the video sitemap plugin file.

  90. Marco

    How do you add the custom type post for search?

  91. Brij

    Nice Post!!!

    I have created a project collection theme based on this custom post type feature.

    See following to download:

    http://www.techbrij.com/342/create-project-collection-theme-wordpress-3-custom-post-type

21 pingbacks

  1. L’Hebdo WordPress : WordPress 2.9 – WordPress 3.0 – BuddyPress | WordPress Francophone
  2. Custom post types in WordPress 3.0 | Hiranthi's weblog - Weblog van een ondernemende vrouw
  3. Fireside Chat with Dougal Campbell, An Early WordPress Developer « WordPress Community Podcast - Online Radio - WebmasterRadio.FM
  4. Whats coming in Wordpress 3.0? | AlexVerse
  5. Mitchell McKenna
  6. Whats Coming in Wordpress 3.0 | AlexVerse
  7. MWUG – Manchester WordPress User Group Meeting 17/03/10 | AUKSEO - Blog from a Search Engine Optimiser based the UK
  8. Was ist neu – Wordpress 3.0 | Kroro.de - Robert Kropf
  9. WordPress is not YET an enterprise-level CMS - Idealien Studios
  10. Rewrite rules för custom post i Wordpress 3.0
  11. WordPress Query Quick Tipps – bueltge.de [by:ltge.de]
  12. WordPress Glossary » wpMethod
  13. Exciting Tech Times | Mephistos
  14. Custom Post Types ab WordPress 3.0 nutzen
  15. Fireside Chat with Dougal Campbell, An Early WordPress Developer | The WordPress Podcast
  16. WordPress 3.0: Changing The Way We Manage Content | Tools
  17. WordPress 3.0: The Beginning of WordPress Tumbleblogs?
  18. Useful Resources and Tutorials to get started with WordPress 3.0 | AllWeb Magazine
  19. Useful Resources and Tutorials about WordPress 3.0 | All Web Magazine
  20. What Can You Expect From WordPress 3.0 — ForSite Media
  21. WordPress Custom Post Types (Teil2): Selbst individuelle Inhaltstypen und Taxonomies anlegen | Elmastudio