Custom Post Types in WordPress 3.0

I know it’s too early to speak about WordPress 3.0, but I’ve been playing around with some of it’s enhancements the other week, and.. Well, this is a miracle, really. Remember all those plugins promising custom post types in versions prior to 3.0. Those that never get updated and show themselves glitchy sometimes, especially during upgrades? Well the time has come.

In version 3.0 the developers of WordPress introduce the custom post types. I’m not sure whether it’ll be solely built into the API or also displayed as a GUI somewhere in the settings, but it doesn’t require too much coding skills to add a couple via your functions.php or a perhaps a plugin.

Well, first I’d like to share a few thoughts of what could be accomplished using these custom post types, and I think that some of the first ones to appear would be

  • Photo Posts
  • Quotes
  • Chats
  • Audio/Podcasts
  • and of course Video

These are basically the things that you’re allowed to post at Tumblr, but hey? We could already post these at the standard Posts type. Exactly, we could! But the custom types perhaps is a step to more organization, rather than functionality.

Why would we want to play around with custom fields, or add stupid meta boxes in the Edit Posts page and then teach our clients and/or content managers to use them? Why not just get rid of all those stuff and have them seperately in your main menu, and the meta boxes are customized to match the exact needs of certain post types.

Custom Post Types in WordPress 3.0

For instance, why should the Edit Post page contain the ability to attach an audio file if it won’t be used 50% of the time? Or why would Quotes contain post revisions? Chats and Video posts wouldn’t require image posting, right? This way you can talk to your client or content manager in a certain way:

John, could you please add a new Podcast? Here’s the MP3 file.

Instead of

John, I need you to add this MP3 file as a Podcast – please add a new post, then in the box on the right you should pick that your post type is a Podcast, then a little bit lower in the next box you should upload this audio file, and also please make sure that you check the Podcasts category before you publish.

No, John, don’t touch the Video box, we use that for video posts. No, leave the custom fields as they are, you should never touch that area

See what I mean? Manipulating also comes in clean and handy. You don’t have to sort different post types into different categories, then use the Edit Posts screen and set filters to a certain category to get a list of Podcasts. Wow.. Also, once your post is a Podcast, it doesn’t hurt your eyes in the Edit Posts section, it’s not visible there at all. Once a Podcast – always a Podcast ;) Awesome isn’t it?

More awesome is the way you can customize the columns in the Edit screen to fit your needs, for each and every post type! Take a look at this Podcasts Edit screen example:

Custom Post Types in WordPress 3.0

Now isn’t that awesome? I bet it is!

So what else could be done with WordPress’ Custom Post Types? Well, basically anything. Say you run an online store which of course has some static Pages (such as Contact, About, etc), some blog Posts, cause we’re so 2.0, remember? And Products, which would be a custom post type that contains the product name, description, product price, stock availability, and could even contain inquiries in forms of user comments!

One more example – a Real Estate Agency, same story – Pages, Blog Posts, News stories, property For Sale, property For Rent, Land for sale. The last three would contain extra taxonomy in forms of Country, Region. Custom fields such as price, total area, etc. The Edit Property page could even contain a Google Map where you could point out its location! Here’s a screenshot:

Custom Post Types in WordPress 3.0

Amazing!

Using Custom Post Types

Yeah, all this is good, but it gets even better as soon as you find out how easy it is to define (register) Custom Post Types in WordPress 3.0! Err.. This means that you have to actually switch to 3.0 before any of this works. Read the article on Nightly Builds, switch to a 3.0-dev branch and launch an upgrade. You should be able to get 3.0-alpha by now.

So let’s try to add a Podcasts type and let’s go straight to the code:

// Fire this during init
register_post_type('podcast', array(
	'label' => __('Podcasts'),
	'singular_label' => __('Podcast'),
	'public' => true,
	'show_ui' => true,
	'capability_type' => 'post',
	'hierarchical' => false,
	'rewrite' => false,
	'query_var' => false,
	'supports' => array('title', 'editor', 'author')
));

Oh my god! Is that it? Yes! I wouldn’t like to go through the parameters but you could read about them in the WordPress Codex – Function Reference: register_post_type.

Perhaps the tricky part would be with the custom columns? Nah:

add_action("manage_posts_custom_column", "my_custom_columns");
add_filter("manage_edit-podcast_columns", "my_podcast_columns");

function my_podcast_columns($columns)
{
	$columns = array(
		"cb" => "<input type=""checkbox"" />",
		"title" => "Podcast Title",
		"description" => "Description",
		"length" => "Length",
		"speakers" => "Speakers",
		"comments" => 'Comments'
	);
	return $columns;
}

function my_custom_columns($column)
{
	global $post;
	if ("ID" == $column) echo $post->ID;
	elseif ("description" == $column) echo $post->post_content;
	elseif ("length" == $column) echo "63:50";
	elseif ("speakers" == $column) echo "Joel Spolsky";
}

Whoot! All done. As seen in the code above, there’s an action and a filter involved. The action outputs custom columns depending on the type, while the filter simply defines the columns for the Podcasts post type. It’s as simple as that. Note that I trimmed the code a little bit to fit on screen, so you shouldn’t be simply outputing 63:50, but actually count the podcast length ;)

That’s about it, folks! Cheers, and say, What custom post types are you thinking of implementing in the first place? Please share via the comments. Thanks!

Follow up: Extending Custom Post Types in WordPress 3.0

392 thoughts on “Custom Post Types in WordPress 3.0

  1. What a great post Konstantin! I knew all along that WordPress wasn't simply a blogging platform. There are tonnes of examples out there that are using WordPress as a CMS, and with this feature coming along it'll be even easier to customize!

    Podcasts and Video posts and all the others, that's surely a way of organizing things, but the extra functionality is at the e-commerce side, as you said – Products, Real Estate, maybe also Events, Lists or Roundups, Tweets Collections, Tutorials.

    P.S. According to this ticket in the WordPress Core Trac, the GUI for managing custom post types will not be built into the core, which leaves an opportunity for plugin and theme developers.

  2. Hello world! « MagicOfWord – Die Zitate und Sprüche Community

  3. Hello world! « The Internet Millionaire System Blog

  4. I couldn't figure out how to get the custom columns working, is your code correct? Copy and pasting that just gives me a blank admin screen.

    Thanks, Kris

    • The code above is missing a quotation mark in function my_custom_columns, thats why it will result in a blank page:

      To fix this, change:
      function my_custom_columns($column)
      {
      global $post;
      if ("ID" == $column") echo $post->ID;
      elseif ("description" == $column) echo $post->post_content;
      elseif ("length" == $column) echo "63:50";
      elseif ("speakers" == $column) echo "Joel Spolsky";
      }

      Into:
      function my_custom_columns($column)
      {
      global $post;
      if ("ID" == "$column") echo $post->ID;
      elseif ("description" == $column) echo $post->post_content;
      elseif ("length" == $column) echo "63:50";
      elseif ("speakers" == $column) echo "Joel Spolsky";
      }

    • Thanks Ed, it was an extra symbol btw, not missing. Anyways it works both ways, but I prefer to keep my variables out of strings ;) Cheers!

  5. Interesting post!
    Now the only thing i can't get my head around yet is an easy way to add custom write panels to custom post types. You seem to have done this on your Real Estate Example. Do you just use custom fields or did you make custom write panels (which is the cleanest way i guess)?

    Thanks in advance for your reply!

    • Thanks Ed!

      Well, I personally think that the cleanest way would be hiding the custom fields from the post screen and writing so-called metaboxes to fill it up with functionality, which at the back would actually use custom fields to store the data. What about you?

    • Sure Ed, this is how you add a meta box to the custom post type called "property": <code>add_meta_box("my-id", "Title", "func", "property", "side", "low")</code> where func is your callback function which displays the text inside the box.

      Hope that helps. (worksforme ;)

  6. wow, amazing! I've been using Wp and Tumblr side by side for some time, this would open up a whole new field for theme developers (& plugin devs too). Can't wait for all the cool stuff!

  7. Hi Kovshenin

    Thanks for this it's really helps getting started :)

    However it works in the admin screen (I can see, edit and create podcast entries) but when I got to view them on the actual site I just get a 404 error. I'm using a fresh WP3.0alpha install for testing so there shouldn't be any conflicts from plugins, modifications etc.

    Can you think of any reason an entry would be created fine but not show on the actual site?

  8. GREAT improvements! It's just what i needed for certain project types.
    Keep up the gook work guys!

  9. GREAT!

    We make custom portfolio themes and this will make life so much easier for users! Being able to create a separate post section for galleries is a great idea.

    Bring on 3.0!!!

  10. Or you could just learn Drupal.

    Check out CCK which lets you create custom content types (posts in the WordPress world) and add custom fields of all sorts to individual content types.

    Then check out Views which lets you create filtered pages and blocks of content based on content types and values in individual content fields. Views Slideshow is an awesome extension of Views that's worth looking at too.

    I know ….. there are some pretty good reasons why most of you are using WordPress rather than Drupal. But given the excitement this post has generated, it's at least worth a look at how Drupal already does this …. ?

    David

    • But what Drupal gains in powerful features it loses (massively in my opinion) on simplicity and usability, especially for the end user. I have worked in both, and prefer WordPress, even though in some cases it's harder to setup, requiring 10 minutes of thoughtful code rather than an hour setting up a CCK type.

  11. Sounds great, though I tried and not understood about the columns you create in the admin panel for editing, where are these fields of "length", "speakers" etc inside the post type editing itself? should these be custom fields ? where they are being defined?

    • Maor, in my example above they're not being defined anywhere, it's just something I wrote to get an example of the UI.

      When actually dealing with such stuff, yeah, you'd probably use the post meta (aka custom fields) to store such data and display it in columns in the my_custom_columns function.

    • Hey Jason, looks good, as a user interface to adding and managing custom post types. But why would you need such an interface? If you're a theme or plugin developer you'd rather deal with 10 lines of code than the GUI. If you're not a theme or plugin developer, why would you add custom post types in the first place if you've no idea how to use them?

      I've seen this question somewhere in the WordPress Trac, they asked for a GUI to manage custom post types within the core. Ticket was closed and marked as invalid.

      As something to temporarily fix the gap, perhaps, though personally, I'd rather wait for 3.0 ;)

      Cheers!

  12. Finally, custom post types in WordPress 3.0 ! - Blog of Leonid Mamchenkov

  13. Today in WordPress world – 27/03 | Links | WereWP

  14. That looks great!

    Now the great think would be to be able to combine these custom columns with taxonomies, and display the content of taxonomies in that view. I will look into it, because it looks promising!

    • Right Jeremy. It's fairly simple to do that as the $post global is available during customizing columns. You could basically squeeze any kind of information there, as well as custom fields and post attachments, such as images.

    • Not that simple for me unluckily. I have been trying, I do not find how to display the taxonomy content :(
      Could wou help me with that? I guess it would be something like $taxonomies->taxonomy_content, but I don't really know…

    • Assuming you're in the my_custom_columns function, get the post contents using <code>global $post;</code> then use something like <code>$terms = get_the_terms($post->ID, "location");</code> to get the location taxonomies for the current post.

      I actually wrapped that up in a function called get_the_location() which belongs to my class, then I call $this->get_the_location() which gives me an array of the terms together with their links, so I simply implode() and echo.

      Of course you may want to output different taxonomy than location, it's just that I'm working on this real estate thing..

      Good luck!

  15. Well, these custom post types features probably will be the biggest new thing in WordPress 3.0.when it comes out. I'll probably use them for adding different media and write/publish articles in a couple of languages. Thanks for explaining. Secondly maybe the multiple domains on one installation, which I am not familiar with as yet.

    • Multiple domains? Are you sure you want to run a single database for multiple blogs? I'd rather run seperate databases under one installation to share the static content, themes, plugins, etc, but definitely not the database.

      I wrote about this last year with a few experiments, it's as simple as determining the domain in wp-config.php and then setting the correct database settings.

    • Thank you Konstantin. Yes I agree with you, or better to say thanks for your opinion and help on the "separate databases under one installation to share the static content, themes, plugins, etc, but definitely not the database". I will find your page on the "determining the domain in wp-config.php and then setting the correct database settings", to learn somethings new for the wp version 3.

  16. Great writeup of this new feature. I'm looking forward to playing around with it. We'll probably use it to create custom posts for the following:

    Testimonials
    Press
    Events

    Another step in the right direction for wordpress. Thanks again.

    Jesse

    • Good idea Jesse, yeah that's a big step forward for WordPress being used as a CMS rather than a blog platform. Products, Clients.. We could even organize a CRM inside making certain post types private. The possibilities are endless!

    • Not quite. I believe the core support custom post types, but there's no functionality to display the extra edit post screen in the admin panel, plus some bugs are being fixed in 3.0, taxonomy, etc.

  17. Wordpress 3.0 i “Custom” tipovi zapisa | Svakodnevnica blog

  18. Are the custom posts by default in the same feed? Can you have separate feeds in 3.0, like you can in Expression Engine? The custom post types in EE go along with a custom feed. So you could have a portfolio post template that is tied to the portfolio, and an articles post template for the articles feed, etc.

    • Douglas, I believe they go separately, as by default WP_Query assumes that post_type is set to "any" which means "post", "page" or "attachment". Maybe that'll be changed in the future to support custom post types, but until then you'll have to explicitly state post_type=yourtype in order to get the content.

      That area is being played with every day though, I filed a ticket myself today about custom post types and taxonomy. It is a 3.0 feature though and it's still in the alpha stage, so I guess we should give the guys some time to wrap things up ;)

      Anyways, about the feeds, you're always free to play with WP_Rewrite and define your own rules for printing RSS content, i.e. direct posts to:

      <code>index.php?post_type=yours&feed=rss</code>

      I guess.. ;) Cheers!

  19. 5 things I learnt this week | Revium | Web Developers, Web Design, Melbourne

  20. I have been using a lot of custom fields in the past six months to bring databases online through wordpress. Many years ago I used Drupal and found that the data was locked to what drupal developers consider a plugin but most users considered a main feature the CCK. It got to a point a few years ago were there were some serious security improvements in a new release and the CCK was not being updated for months so I exported my sites bit the bullet and moved to WordPress…

    Now I am at the point where my sites are deployed in WordPress and it seems the codebase is going through another radical change.

    I seriously hope that any transition away from Custom Fields won't happen like the decision to remove ID's from the dashboard…. in the dark of the night with no notice to end users.

    When Development time is equal to or larger then the time spent actually making content this is where the line is drawn for most users…

    I have a bad feeling the 3.0 codebase is going to be a real serious step for all of us to adjust to.. some people won't want to continue if the redeployment time is equal to a transition to a different platform even if that means a end user designed platform.

    I have considered many times why I even take that next step from grabbing a CSV MDB or XML Database … dumping it into MySQL and then preparing it for importation to WordPress.. why not just keep it in the database and write my own code to allow new posts…

    The reason is extendability.. well that is the reason now.. but then again I have that decision do I need to use a Sociable or GoogleMaps or Akismet plugin so bad that I am willing to go through not only importation … but a transition that will take more time to process … then the time I spend making content..

    This is a serious consideration MATT needs to decide.

    Hopefully since I have not been downloading beta it will be smooth

    If not then everyone who isnt a 16yo girl running a hello kitty / Hanna Montana site will need to decide which direction they move…

    Fine Grain Control vs dumping it all in the_content..

    We will see.

  21. Doliaku! :::: » links for 2010-03-29

  22. It's important to note that custom post types are not equivalent to custom post flavors, and if you use them that way, you're going to be disappointed. It's best to think of them as custom content types. Some better examples:

    - Products
    - Events
    - Albums

    Custom content types are not going to be in your main feed, a very important caveat. We're working on ideas for custom post flavors, which would be more of the "video post" vs "audiocast post" variety.

    • Good point there Mark, though with a little bit of coding magic you could get a mix of your ordinary and custom posts on any page at any time ;) you could even stick pages to them, show attachments and links. Oh yeah, that's what I call flexibility! Viva WordPress ;)

    • Mark, thanks for pointing this out. While this article doesn't cover the "supports" parameter, I'm glad that is an option to easily add capabilities such as excerpts, comments, etc. It even lets you specify whether the custom post type appears in searches. However, I'd like to see a couple of extra parameters added:
      1. Display in blog – Allow us to specify whether or not these custom post types appear in the standard blog pages
      2. Display in RSS – Allow us to specify whether or not these custom post types appear in the standard RSS/Atom feeds. If turned off, then have its OWN feed separate from the main feed. i.e. we'd have RSS Feed, Comments Feed, and whatever Custom Post Type Feed.

      I've been thinking of writing a forum plugin that uses custom post types, so that the code could be dead-simple, using all the built-in WP capabilities, with the data stored in the standard posts file for easy export/import, etc. It would be great, though, to be able to choose to include forum posts on the home page/index pages and/or in the standard RSS feed or not.

      Other uses of custom post types, especially the "video post" and "podcast" type posts, would definitely make perfect sense to include in home/index pages and in the standard RSS feed. With the above suggested parameters, both use cases could be handled.

  23. I use a plugin called Magic Fields that seems to offer what you are describing. I use it for a pet shelter site so people at the shelter can create posts for cats and dogs. They pull up a new post in the cat section and it asks for breed, age, declawed, good with kids, photo, etc. It is a great way for making sure that the users at the shelter include all the data needed for a pet listing.

    If that is what you are describing here that would be great to have directly in WordPress, although shout out to Magic Fields because it has worked very well.

    • Magic Fields, More Fields, yeah there are tonnes of plugins that do that, and as mentioned above there are some that fill the gap between 2.9 and 3.0, as the register_post_type was introduced in 2.9, but without the interface ability which is set for 3.0 ;) But if you're okay with such plugins for particular cases then you shouldn't worry. But when you'd require more customization, implementation into the theme, etc, etc, then you'll be better off with core functionality.

  24. Weekly Round Up: Issue 2 | Jason Ashdown's Blog of Wonders

  25. Artikel und Links — 30th März – Flrnz.

  26. Great post Konstantin, thanks for showing so great examples. This feature would be useful for me.

    • I wouldn't call this easy, but here's a way without patching WordPress:
      <code>add_action("in_admin_header", "my_menu");
      function my_menu() { global $menu; print_r($menu); }</code>

      This will give you an array of all menus which at this stage may be changed or shuffled.. I guess there should be a filter somewhere where $menu could be changed in a more usable way. You should look for it in the sources. Hints are admin-header.php, menu-header.php.

      Cheers!

  27. WordPress 3.0 coming soon with custom post types and multi-user built in | MBJWORK

  28. WordPress › Blog » WordPress 3.0, Beta 1

  29. WordPress 3.0, Beta 1 | Wordpress Services

  30. WordPress 3.0, Beta 1 | ByteBooth

  31. WordPress 3.0, Beta 1 » e-Learning by e-Learning

  32. عبدالملك الثاري – مطور ومصمم مواقع وتطبيقات ويب » ووردبريس 3 (بيتا 1) الأن تم إصدارها مع التجربة

  33. Sneak Peek into Wordpress 3.0 beta1 | OrkutHeroes.com

  34. WordPress 3.0 Beta 1 - WordPress, Post, Types, Multiblog-Funktion, WPMU, Zusammenführung - WordPress Deutschland Blog

  35. WordPress 3.0 nám stúpa na päty, Beta 1 « WordPress.sk

  36. Oh Noes: Wordpress 3.0 Beta released

  37. Hi,

    nice post! Really good summary on the feature!

    Tiny thing that you should probably change: In your code for register_post_type() you are using the "_builtin" and "_edit_link" parameters, although they are for internal use only (you probably have them in there, because you copied the code from the "post" and "page" post types). Especially setting "_builtin" to true could lead to problems in future version, so I recommend removing both of those parameters from your function call.
    "_builtin" will then be set to false and the "_edit_link" to the same as now.

    Best wishes,
    Tobias

    • You're right, I did copy the code from post/page registration and they do cause problems when querying, I explained this issue in the follow-up post. Anyways, removed them from this posts' code, thanks for pointing it out.

  38. WordPress 3.0 beta 1 发布 | Donui

  39. WordPress 3.0 beta 1 disponible | WordPress Channel

  40. WordPress 3.0 beta 1 发布 | CNzeta

  41. WordPress Picks for the Week [03/31] | Techtites

  42. Definitely a great addition to WP and from how it's explained it seems like it will be quick and easy to use also. Great work and I'm looking forward to this!

  43. Thanks for great explanation.

    Sidenote: I think with your comments-array, you have "," too much at the end.

    • I use extra commas in such arrays as I constantly add and remove stuff. PHP is fine with extra commas but causes errors when lacking ;) Corrected the code, thanks!

  44. WordPress 3.0 Beta Released « Demola’s Wall

  45. First Look: Wordpress 3.0 | Greg Rickaby dESIGN

  46. WordPress 3.0 Beta 1 发布,简要中文说明 | 大海个人网站

  47. wordpress bate 1版本发布 | blueandhack's blog

  48. I think this is actually a much more intelligent way to approach things. Anyone who has wrestled with a client trying to use a complicated theme (studiopress.com anyone) will know that keeping the options on the add post/page pages makes sense and keeps support at a manageable level.

    I have had phonecalls with clients that have left me wanting to throw my laptop out the window so keeping it simple works out really well for me.

    Disclaimer: not all clients are hopeless, just most of them. ;o)

    • Right, some of them also dislike WordPress' built-in admin system so they ask you to build custom ones, with the layout they describe ;) they're called Clients from Hell haha

  49. Wordpress 3 beta 1

  50. WordPress 3.0 Beta 1 | Ken VN Blog

  51. Wordpress 3.0 is HERE!! WooHoo! - Virtual Results : Virtual Results

  52. Wordpress 3.0 Beta ist da! - Ursoundz.de

  53. Wordpress 3 Beta 1 Download: Let the fun begin | Geekatude.com

  54. WordPress 3.0 Beta 1发布 - Anear's Space

  55. WordPress 3.0 Beta 1 Screenshots, Impressions – ZekeWeeks.com

  56. WordPress 3.0, Beta 1 Released

  57. Wordpress 3.0 : le point sur les nouveautés | Fredzone

  58. WordPress 3.0, la versión Beta 1 | Daniel Calisaya

  59. How to Get an Early Start With WordPress Multisite 3.0 Beta – Now Available For Download - WordPress MU and BuddyPress plugins, themes, support, tips and how to's

  60. First Look at WordPress 3.0 Beta | HighEdWebTech

  61. So, it's a CMS. Yay. Already solved that problem a decade ago. Ah well, this will make it a more viable alternative to more complicated solutions for simple sites. Better late than never. That is, if they make a GUI for it.

  62. Wordpress 3.0 Beta Pictures : Nibelung Valesti

  63. Wordpress 3.0 une mise à jour ambitieuse! | Descary.com

  64. WordPress 3.0 Beta 1 Now Available

  65. Liberado WordPress 3.0 Beta 1 | Diseño web, accesibilidad, usabilidad, posicionamiento y optimización web - AlmacenPlantillasWeb Blog

  66. Tiago Dória Weblog » Blog Archive » Versão 3.0 potencializará WordPress como CMS

  67. WordPress3.0 beta 1 发布 » 移动互联网|手机应用|桌面应用|网络应用|IT新闻|wordpress|流浪的枫之羽

  68. 45+ Fresh Wordpress Tutorials, Techniques and Hacks | EMDMA

  69. Clients say the most hellish things... 2.0 - Page 17 - DesignersTalk

  70. Wordpress 3.0 beta 1, disponible « Bichotoblog

  71. Download and test Wordpress 3.0 Beta 1 | Anton Koekemoer

  72. WordPress 3.0, Beta 1 « Llanpumsaint Community Information Exchange

  73. Get Ready for WordPress 3.0 | BloggingPro

  74. Wordpress 3.0 Beta 1 Released! | WPspecial - Wordpress Magazine

  75. WordPress 3.0 beta 1 发布 - 铁盒子

  76. WordPress 3.0 Preview - WP Mods

  77. I like this idea a lot. Currently I struggle to get clients to understand the difference between a post and a page, let alone figure out how to create special types of post. I hope this puts an end to all that messing around with custom fields and categories then having to explain it all to clients.

  78. WordPress 3.0 ベータ 1 | WWWP

    • What to say about this feature? AWESOME!
      For so long, I was searching a way to customize my wordpress instalations to fit almost everything I wanted, but was too complicated… needed to wrote a plugin and create a new database table, etc… now is just WOW: A true-friendly-very-customizable Framework!
      Graphical Interface? Perhaps the next step?

  79. OK, I kind of get it but where would I put this code exactly?

    I tried looking through all the other comments but they weren't loading for me.

    • This code as you can see it is not meant for a plugin.
      Where else? Good guess. In your template's functions.php file.
      I tried it on the default theme for wordpress 3.0 and on checking my dashboard on the left menu I did have podcasts.
      Wow! I never thought it could get that easy . Thanks Kovshenin!

  80. Netchunks » Wordpress 3.0 Beta 1 Released – Now Tried and Tested

  81. WordPress 3.0, Beta 1 « Salal's Blog

  82. With WordPress 3.0 is it possible to post some differents articles :

    For example for a hardware / high tech webzine :

    - (classic) post for news / actualities
    - articles for reviews, guides, etc..

    If yes, how it's work in the database ? Is is in differents DB tables ?

    Thanks in advance ;)

  83. WordPress 3 - Ryan Boswell

  84. WordPress 3.0 Beta1 リリース | AZ::Blog

  85. Wordpress 3.0 Beta 1 небольшой обзор : Vidanov Digital

  86. WordPress 3.0 – The Ultimate One! | Blog Design Studio

  87. WordPress 3.0, Beta 1

  88. Anonymous

  89. WordPress 3 | Karen Friesen

  90. WordPress 3.0 Beta 1 has arrived! | WindowsVJ.com

  91. Is there an easy way to link the different post types together.

    I know it is possible to do "Taxonomies" to a post type but I want link them together in the same way tags would work. Say I create a post type called "Cars." Here I create various car models. Then I create a post type called "Reviews" and use the standard post type as "News." Is it possible to add car models to these two post types as you would tags? So when I'm looking at a "Porsche 911" cars post I can see all the related "reviews" and "news" posts?

    Hope it makes sense!

    • It does.. And it's called theme magic ;) You could run a WP_Query to look for the same post but of a different post_type and fire the loop from there.

  92. Спасибо за пост. Только что попробовал эту фичу вместе с multisite на localhost, – все работает "на ура". Подтягивается ВП к Друпалу :)

  93. Wordpress Help - Descending Boxes - DesignersTalk

  94. This is the best decision Automattic has made with this software in years. I for one, am excited about this. Currently, I've been using Flutter for this purpose, but I have been having the hack the life out of it to keep the number of DB queries with in a reasonable limit.

  95. Thanks for this. Interesting to see what possibilities are possible with custom post types. Can't wait to try it out and see how much time and effort it saves.

  96. Wordpress 3.0 – The new Era | Creative Cue

  97. labs.dagensskiva.com » Blog Archive » We want More Plugins

  98. WordPress 3.0, Beta 1 » blog.lanche86.com

    • Hi Chris! Thank you for this — I was struggling to figure out how to pull the custom fields — this solved it!

  99. WordPress 3.0: Custom Post Types « Changing Way

  100. WordPress 3.0 Beta 1 è arrivato! | Win-OPen

  101. Thanks for the good article!
    I've a question: the above "my_podcast_columns" works ok when in "register_post_type" I set "hierarchical" as FALSE, but it does not when set as TRUE. Why?

  102. Fantastic! For those who want to have thumbnails display in the edit columns for a custom post type, check out WP-Engineer's post on the topic for non-custom post types. Combining that with your efforts was a snap and looks fantastic.

    Just trying to find out a way to – for specific data types – retitle "Featured Image" to be meaningful for the data type (i.e. Podcast Image, CD Cover Art, Main Property Image, etc)

  103. 45+ Fresh Wordpress Tutorials « MoeMir

  104. La mise à jour WordPress 3.0 arrive le 1er mai PRÉPAREZ-VOUS | Diane Bourque

  105. Around the WordPress Community: WordPress 3.0 is the Talk of the Town | WordCast - Blogging news, Blogging podcasts, WordPress podcasts, WordPress plugins, WordPress themes, WordPress news

  106. Custom Post Types ab WordPress 3.0 nutzen

  107. WordPress3.0 beta 1 发布 - 剑行云端

  108. Would you (or someone reading this) mind helping me out in explaining how an additional filter option can be added to the admin post list screen based of hard coded meta key variables/taxonomies or automatically listed based off meta key/taxonomy values?

    I am also looking for a way to be able to "sort" the columns up/down and set a default column to sort the edit post results by.

    I feel this is very important to be able to utilize these custom post types correctly and effectively for clients.

  109. Thank you Konstantin! – great post and tips :) after seeing this, I'm looking forward to what we can do with WordPress 3.0!

    To echo binarypixel above, is there a way to sort the posts by any of the columns?

    • You're welcome. Sort order, yeah, all you have to do is hook to the posts_orderby filter when selecting them and write your custom SQL. I managed to make the column headings clickable so that you could pick ones to sort by. Just make sure you filter when is_admin() otherwise you can mess up the order in your theme.

    • It really depends on your needs, which fields you'd like to use to order, how to order them etc. Just Google the posts_orderby hook or read it in the sources. It's simply a way to inject your stuff into SQL.

  110. Fantastic work! I'm thrilled about the prospect of soon using 3.0.

    One question… I couldn't help but notice that in the second image of this post, your "Speakers" were not alphabetized!!! "Joel Spolsky" followed by "Jeff Atwood".

    I checked out the code, and you register the variable "speakers" with the following:

    register_taxonomy("speaker", array("podcast"), array("hierarchical" => true, "label" => "Speakers", "singular_label" => "Speaker", "rewrite" => true));

    and then you echo it with the following:

    case "p30_speakers":
    $speakers = get_the_terms(0, "speaker");
    $speakers_html = array();
    foreach ($speakers as $speaker)
    array_push($speakers_html, '<a>slug, "speaker") . '">' . $speaker->name . '');

    echo implode($speakers_html, ", ");
    break;

    I have been pulling my hair out looking for a way to list authors (or any variable) in the order they were inputted per post. For example, Joel Spolsky would be listed first on one post, but he could be listed second on other posts. Does this method achieve that?

    • I'm not sure.. It's taxonomy after all.. Meta data, which shouldn't have an order. You might want to go with custom fields instead.

  111. Nice post :D

    I am so excited to get going on my new project – it is going to make the site so user freindly!

    Thanks again for the great post

  112. GREAT!
    What about has_one, has_many and other complicated but funny relationships we can get our data in?
    I love to play around with this feature. Though I'm afraid (but happy) WordPress will lose her Word Press core usage ;-).

    I expect one of the next-most-used types will be "Products" in 2012 …

  113. Rob and Kill » Custom Post Types in WordPress 3.0

  114. Great post but I have a question!

    I've created custom post types and I have pages where you see all posts of the specified type and the single post. Is it possible to have a custom post type category listing page?

    I have /custom-post-type/ working fine, that lists all posts of that custom post type.
    I have /custom-post-type/post-name working fine, that shows a single post within the custom post type.

    I want /custom-post-type/category/ where you can see all the custom posts within the specified category, is this possible?

    Thanks!

    • Sure, create a post called category and give it a custom post template, in which you're free to do any php coding you like ;) P.S. Post templates are not a WordPress standard. WordPress has only page templates, but google for a way to implement it into posts.

  115. WordPress se hace multidominio

  116. I'm intrigued by that custom post category question as well. You'd think you'd be able to just put "category" into the "supports" array of the register_post_type array, but it don't work. Hmmm.. Anyone any ideas about this? It would be pretty handy.

    • Files? Yeah, you could pretty much implement a file versioning system like in Basecamp by 37signals, but I doubt that you'll reach Subversion or Git level with WordPress, there's too much parsing to do. You'll be better off implementing Svn/Git into WordPress :-P

    • Actually I'm looking for a middle ground here. If someone wants specialized version control there are already tools for that. However for something basic like starting a software directory this may come handy. Git/SVN into wordpress? I'm all ears…any pointers to get started?

    • Well, take a look at Trac ;) I'm looking for something similar, but more of a CRM and/or project management tool, sort of like Basecamp maybe, but the source control in Trac is simply awesome, and awesomely tied to Subversion!

  117. WordPress 3.0 Beta | Eleven Media Web Design

  118. WordPress 更新 WordPress 3.0 Beta 1发布 | 博客吧

  119. » Blog Archive » Novidades do WordPress 3.0

  120. WordPress 3.0 Custom Post Types: Joke posts

  121. Le novità di WordPress 3.0 — Studio404 Web Agency

  122. WordPress 3.0, Beta 1 | Articles On

  123. This works great I had to add 'title', 'editor', 'author', to the array to get a normal looking post.

    I'm running WP 3.0 Beta 2 and I can't see the Featured Thumbnail feature with a custom post type. I have included the 'post-thumbnails', in my array.

    I can see it fine when I create a regular post.

    I was wondering if anyone else had this issue a solution.

  124. Short snapper because I really haven't spidered this functionality yet … maybe I'm way off base.

    My idea is this (with a long-shelved project in mind): re-entrant material.
    I.e. I "comment" on blog post A, but that comment itself becomes a post.
    When I look at post A, I see what appear to be normal comments. But some of those comments are special: clicking on them doesn't reveal just a nested tree of replies but, rather, presents that material as a stand-alone post.

    I bring it up now because I think Post Types can pull this off … maybe combined with Custom Taxonomy.

    cheers

    • I guess it's what comment meta is for, but you can always restructure the whole commenting and use post_parent to indicate posts which are comments, maybe custom post types could help, yeah but I'm not sure about selecting. Let us know when you figure it out ;)

    • Sorry I missed your reply @kovshenin … always makes me shudder when email notification slips past; no telling the consequences!

      It might be doable through meta, but I suspect … meh don't want to hex myself into extra complexity right off the bat. (This is long-term / deep background for me; "ASAP" but no rush. *G*)

  125. WordPress 3.0 release « 米可演示中心

  126. Wordpress Beta | O Ponto

  127. WordPress 3.0, Beta 1 | Saktesh Ethan's Ultimate Internet Cash - Make Money Online Easily

  128. As principais novidades do WordPress 3.0 « Meio Bit

  129. Blog.UNDAKOVR™ » WordPress 3.0 Beta 1 | Web Wonder World

  130. Bas van der Lans – Publish ßeta » WordPress 3.0 in Helder Hollands

  131. WordPress 3.0, Beta 1 | Best Cyber Solutions

  132. Extending Custom Post Types in WordPress 3.0 | Jack love you

  133. Marcus Antonius » Blog Archive » As principais novidades do WordPress 3.0

  134. Using Flutter for a Restaurant Menu in WordPress – sara cannon

  135. Why Custom Post Types are Great | alexking.org

  136. Tips & Guider till WordPress 3

  137. Hi Konstantin I'm sitting down to do a project for a client's site needing a Real Estate section. What you have in your screenshot is exactly what I had in mind. I'd rather not reinvent the wheel, so to speak, if we could work out an arrangement. Could you please contact me at either my e-mail or DM me on Twitter. Thanks, and great info on custom post types!

    • Lindy, the real estate module is a commercial project that's being done within our company. I'll pass on your contact details to our sales team and you could talk it over with them. Hope that's fine with you.

      Thanks

  138. Custom XML-RPC Methods in WordPress

  139. Premier test de Wordpress 3 — Blog d'un WebActeur !

  140. WordPress 3.0, Beta 1 | Raven Developers

  141. WordPress 3.0, Beta 1 | Web Hosting Complex

  142. Rewrite rules för custom post i Wordpress 3.0 | myWorld

  143. If our understanding is correct, custom post types are primarily going to be set up and managed in functions.php – ie, a theme file. This seems totally wrong: these post type definitions don't belong to a site's theme, they should be part of its underlying structure. Custom post-type definitions (and likewise custom taxonomies) ought to be theme-independent, allowing the user to change theme but maintain the site's content and hierarchy.

    Moreover: isn't it wasteful to have these definitions in PHP code in a file which executes repeatedly and redundantly every time a front-end page request is made?

    One more potential drawback of this method: if you edited functions.php to change the post_type definitions once a site was already populated with data, couldn't you quickly lose touch with the contents of the underlying database, with no way of cleaning it up or getting back to your previous state?

    In our 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.

    This is basically a repost of a comment we made on WP-Engineer (http://wpengineer.com/impressions-of-custom-post-type/#comment-4400), so sorry for the repetition, but it seems like an important enough issue to raise here as well to see what people think. We're also rooting through trac to see if our doubts have been raised (and countered) there.

    Any comments? Have we missed something?

    • Initiate them through a plugin. Then you can swap themes to your heart's content. As for editing definitions after the site's gone live; you're quite right, there'd be lots of homeless data in the database and it would be a fiddle to clear it up. Once you've defined your post types and custom meta, best not to alter it – and actually, I don't see why you'd ever want / need to either.

    • it's just that every site we've come across so far, from nettuts to wpengineer to wp itself, talks about or recommends using functions.php to register the custom post types… and most also say, or imply, "plug-in = bad; core = good" which would suggest that this new (big) functionality ought really to be a new part of wp-admin, no?

    • sorry – I expressed myself badly… what I meant by "most say plugins = bad, core = good" was something more like this:

      commenters on articles about WP3.0's "custom post types" often say that such-and-such plug-in already allowed you to extend WP in similar ways. The response to those commenters is usually along the lines of: "but this is core, so it will be inherently better documented and supported". That would imply that the way in which articles and tutorials (which WP.org itself links from its register_post_type reference page: http://codex.wordpress.org/Function_Reference/reg… are currently suggesting custom post types be implemented is better than using plug-ins.

      …Which alialib and ourselves feel it might not be, if the potential pitfalls of implementing the post types via functions.php turn out to be real.

    • Mmmm. yeswework certainly has a point. My functions.php file is chock-full of custom post code that I'd want to keep if I ever swapped themes. But it's also full of style-specific, theme-specific instructions that I wouldn't want to take with me theme to theme.

      Perhaps there should be the wherewithal to have a file similar to functions.php, that sits outside the theme architecture, maybe accessible in an editor similar to the theme editor in WP. This file could be a global-functions.php, it would initiate custom post types and hold the code to process them once they're in.

      At the moment the lines between theme and core are being dangerously blurred. But with most themes now (serious frameworks with child themes) you wouldn't want to change once the site is live. And if you did, the functions.php could be in the parent theme, and you could change child themes as much as you liked without breaking anything.

      I think the answer to this really is choose a parent theme framework, and then stick with it.

    • Even if writing it into a plug-in is safer and more future-proof than using functions.php, if you have to write (or even just install) plug-ins to implement custom post_types, then:

      a) you could have done it already with podcms, flutter, et al so the advantages of custom post_types WP3.0 for the average user are reduced.

      b) the plug-in (unless it's "canonical" and issued by the WordPress team themselves) is only linked to updates in core WP by the willpower, skill and availability of the plug-in developer, so functionality could break relatively easily (see, for example, the Custom Post Type UI plug-in – it's fantastic, but it's destined to always be one step behind changes to WP3.0 core, so at the time of writing it's partially broken with RC1 under WAMP/XAMPP environments).

      basically… you could still very easily lose access to all your custom posts both on your site AND, worst of all, in the admin section of your site.

      and I'm sure there are other disadvantages too… we just think that the custom post_type (and custom taxonomy) functionality is important enough to helping WP gain more market share (which Matt said in his recent WordCamp speech) that its set-up and basic management should really be built into wp-admin rather than left to a plug-in or theme file.

    • @yeswework – I couldn't agree more. I like Custom Post Type UI (or CMS Press) for their approach of bringing the ability to create custom post types back to the average user and hope that within the next couple of releases of WP that type of functionality might make it into core as well. Along with some way to easily share like the repository offers plugins / themes today.

      Ignoring the obvious "scope creep in the core" question for the moment, it is an interesting development model where features that are highly sought after can flush out the potential implementation strategies as plugins and then a "best practice" approach get implemented to core. I'd be curious to know in the examples of Tag warrior -> tags, wooThemes menus -> Menu management and the "custom post" plugins you mention, how much of their approach influenced the direction of the core development.

    • The sunrise.php file might be along the lines of your global-functions.php idea. I've also tried creating an include in wp-config.php to a file in the wp-content directory that contains functions and classes for use in the global scope (probably not the best idea).

  144. WordPress 3.0 – What’s the big deal? « WP LOGBOOK

  145. I think custom post types and custom taxonomies currently posses "features" that should merge in one kind of type.

    With these custom taxonomies (and the default ones) we can "tie" custom posts together e.g. tag five of them with "olympics2009".

    However "olympics2009" could just as well have a "posting" associated with it as well as some custom fields.

    If you would do "register_taxonomy" with a certain custom post type you would get a list of all posts that had been done in that register_taxonomy.

    Identical to e.g. having custom post types "contact" and "address". To link contacts with addresses and addresses with contacts you now would have to link them up via a custom field that queries "the other custom post type". If custom post types and taxonomies would be the same kind of object you would not have todo this since they would already carry the properties of being tied to each other.

    Then again I might be missing something, just starting up in my wp knowledge.

  146. WordPress 3.0, Beta 1 | Flacher Bauch

  147. Crear una lista de productos con Wordpress 3.0 usando Entradas personalizadas, campos personalizados y taxonomías | emenia.es

  148. Introduction à WordPress 3 : custom post type et custom taxonomy | bbxdesign

    • I'm lusted after this for years.
      I imagine having a suite of PressThis bookmarklets, each one custom configured with specific settings. Select text, Click, Post!

  149. WordPress 3.0 ベータ 1 | wordpress情報局

  150. Template Changes/Tags for Wordpress 3.0

  151. WordPress 3.0, Beta 1 « Wordpress for Business

  152. 5 reasons why you should love Wordpress 3.0 | CMS tutorial site

  153. Google Hot Trends » WordPress 3.0 Features – Every Theme Developer Should Know

  154. WordPress 3.0, Beta 1 | PC TV Software

  155. Custom post types – Hoe, wat en waar? | DDJ Development blog

  156. Anybody on here know if Custom Post Types can be applied retroactively on existing posts? That is, can one do some sort of batch edit on a bunch of older posts and mark them as Custom Post Type XYZ? I'd assume there are many of us who'd like to convert some of our older, normal posts to XYZ to add that additional meta data, but if this only work for posts published *after* upgrading to WP3, when you initialize it in functions for your theme, then that could become a significant road block.

  157. Wordpress 3.0 Roundup | Themergency

  158. Wordpress 3 disponível, aproveite ao máximo as novas funcionalidades « Mateus Neves, Designer, Wordpress and more

  159. 10 Great New Features in WordPress 3.0 | Web.AppStorm

  160. Konstantin, I love the simplicity of this plugin, thank you!

    One question though, if I want to display a list of speakers from the WP_Query function how would I do that?

    I've tried "post_type=podcast" which returns all, but if I wanted to only display posts by speaker "Chris Ross" is there a way to pass something like $recentPosts->query("speaker=Chris Ross")?

    • If the speaker is a custom taxonomy (which would be the best thing to do, imho) you can simply add it to the query, query_posts( array( 'speaker' => 'chris-ross', 'showposts' => 10 ) );

    • I'm building a Event Listing plugin, and have a question on this:

      How do you redirect to a special template in the event of "post_type=event" and the "query_posts( array…." cases?

    • Yeah, I've found that, but I'm looking for a more direct way of specifying the theme page for a single event & category of events & basic list of events.

      I suppose we'll just have to use is_category in the single-event.php page.

    • Hey, Giovanni has probably answered your question already. Taxonomy and post names have slugs (which contain no spaces, symbols, etc) and they should be used when querying the database, which is why Chriss Ross became chris-ross. That way, you can also combine parameters either in an array (like Giovanni has shown) or in a string: query("speaker=chris-ross&post_type=podcast".

      Hope that helps.

  161. Wordpress 3.0 já disponível! - Wordpress Total

  162. WordPress 3.0 Is Out! | Domain names, news and opinions

  163. Wordpress 3.0 «wh1sp.com

  164. WordPress 3.0 – has arrived! | TroysWeb.com

  165. I do not know why WordPress doesn't add the taxonomy to the admin option instead let people add it manually to the function.php file? Does it slowdown the performance of WordPress?

  166. WordPress 3.0, Beta 1 « Sudji's Weblog

  167. Hi there,

    You say "Perhaps the tricky part would be with the custom columns? Nah:"
    I say, YES.
    I've made an exact copy/past of your code and if the "Podcast" shows in the Admin, I never see any custom columns.
    When trying to add a new podcast, I just can fill the title, author and normal editor :(

    • Maybe you misunderstood custom columns? They're the ones that appear additionally to your Edit Podcasts (or whatever post type you're working on) screen.

    • Yes sorry, I was talking about custom textareas & co.
      I can just fill a title and classic text editor!

  168. WordPress 3.0 | Documentandome

  169. WordPress 3.0 beta 1 发布 | LAMP开源技术

  170. WordPress 3.0: Exprimiendo los Custom Post Types | aNieto2K

  171. Items of interest » Blog Archive » Bookmarks for June 19th through June 20th

  172. Utilización de Custom Post Types en WordPress

  173. La crémerie passe à Wordpress 3.0 ! Ce qui va changer… | La crémerie

  174. The WordPress 3.0 Update arrives in May GET READY | Diane Bourque

  175. how would you hook into the save post and make a custom field required?

    For instance if you have a custom field for price. You'll wanna make sure that its not missed. So you'll want to have it required, and if its empty when the post is added or updated it will throw an error.

    • Kyle, I think you should visit the WordPress Support Forums for this one, or perhaps their IRC channel. But here's something you might play with – there's a hook called save_post, inside which you can alter the information being saved in the database, as well as add extra custom fields, etc.

    • Jose, I think that it's once again the permalinks question being asked here for quite some time. I still cannot find an easy way around it in 3.0, but I did manage to get things up and running in the beta using WP_Rewrite by adding extra rules to it, and disabling redirect_canonical (in certain cases).

  176. Пользовательские типы записей в WordPress 3.0 | Линуксблог

  177. WordCamp@Chicago Recap: WordPress for Clients :: www.fuyuko.net 2009

  178. WordCamp@Chicago Recap: WordPress for Clients | fuyuko.net

  179. Wordpress 3.0 Custom posts… PRICELESS !!! | cssOrigins.com | Design Blog, Tutorials, Tips, SEO Optimization, and Wordpress Publishing Platform

  180. Hi,

    I know, the following will be a stupid question, but else what can I do? I'm totally a newbie :D

    How do I make those menu items of post type appear as in the 1st figure?

    Thank you very much!

    • Heh, never came across such a thing, but you may try the Adminimize plugin, I believe there were some options in customizing the admin menu, perhaps there's sorting too.

  181. WordPress 3.0 já disponível! | ComunicaTech

  182. First, thanks for the great article. I followed your example for the custom edit columns and I cannot seem to get it to work. The columns get labeled, but no data appears in the columns. Here is that section of my functions.php:
    add_filter('manage_edit-listings_columns', 'listing_edit_columns');
    add_action('manage_posts_custom_column', 'listing_custom_columns');

    function listing_edit_columns($columns){
    $columns = array(
    'cb' => '',
    'title' => 'Listing',
    'agent' => 'Agent',
    'price' => 'Price',
    'status' => 'Status',
    );

    return $columns;
    }

    function listing_custom_columns($column){
    global $post;
    if ('ID' == $column) echo $post->ID;
    elseif ('agent' == $column) echo 'agent-name';
    elseif ('price' == $column) echo 'money';
    elseif ('status' == $column) echo 'status';
    }

    Am I doing it wrong?

  183. I really want to create a Quotes post type. Can you please provide an example of the code i would use? Also, I am not sure of where I am to place this code in functions.php, any clarification would be helpful.

    For the quote I'd want to have the follow fields: Quote (text), Description (text), Team (select category), Person (text)

    Thank you in advance for the help,

    Jon

    • Jon, did you figure out where to put it? I'm looking into it right now and nowhere do I find it. Thanks

    • Look for samples in the Codex, it's quite clear there. Or you may try looking for a plugin what works with custom post types. I believe there was a good one somewhere in the repo.

  184. WordPress 3.0 Overview – notes | WordPress Austin

  185. Wordpress 3.0, hot? - David Kauzlaric | DavidKauzlaric.com

  186. Custom Post Type + Custom Menujeremyjarratt.com | jeremyjarratt.com

  187. WordPress 3.0, la versión Beta 1

  188. Useful Resources and Tutorials to get started with WordPress 3.0 | ryanriatno

  189. 10 nuevas características en WordPress 3.0 - Reseña a Fondo | Inviadesign - Tutoriales de Photoshop, Illustrator, Flash, WordPress y más

  190. is there a way of ordering the rows on the edit list by one of my custom values?
    in your example, say order by 'length'

    • Hmm, good question Sean. I think you can, but no in the text that is echoed to the table. This should be done inside the query, perhaps via some extra JOINs that would grab up some post meta and use it for custom ordering.

  191. Mise à jour WordPress 3.0

  192. WordPress 3.0 - Antenados Brazil é fã! | ANTENADOS BRAZIL: LIGADOS DE PLANTÃO SE ENCONTRAM AQUI!

  193. Hi Konstantin. In my page.php i want use a conditionnal tag like is_post_type('podcast') but that doesn't work… what can i do recognize a page which have a custom_post_type 'podacst' ?

    • i'm not sure if is_post_type() supports the custom post type. But this works:

      global $post;
      if($post->post_type == 'podcast')

    • that doesn't work on my site…
      but if i use
      global $post;
      if($post->post_title == ‘title of my post’)
      that works…
      Strange.

    • That is strange. Do you think it has to do with how you're declaring the custom post type? Here's my setup:

      register_post_type('sales', array(
      'label' => __('Sale Items')
      ,'singular_label' => __('Sale Item')
      ,'public' => true
      ,'show_ui' => true
      ,'capability_type' => 'page'
      ,'hierarchical' => false
      ,'rewrite' => true
      ,'query_var' => false
      ,'supports' => array('title', 'editor', 'thumbnail')
      ));

      And my template uses:
      global $post;
      if($post->post_type == 'sales')

      Have you done a var_dump on $post var to see exactly what the post type is being set to? That might be helpful.

    • i have copy your first code in my function.php and the second code in my single.php
      but that doesn't work
      i don't understand

    • Ah ha! You can't use the single.php file with a custom post type. Working with the "sales" example, you'll need a file called single-sales.php

      Inside that file i simply put a require to my page.php, though you could point it to single.php.

    • i have create single-sales.php but that don't work

      i have change ’capability_type’ => ‘page’ by ’capability_type’ => ‘post’, that doesn't work… :-/

    • Man, I'm not sure where things are going wrong. At this point I'm out of ideas besides doing var_dumps and manually tracking down where things are going bad. You might want to head over to the wordpress.org Forums and post there (if you haven't already).

  194. Hello.
    Konstantin, I'm sure you know if it's possible to divide custom fields for custom posts?
    I mean I have custom post type "Podcasts". And its item has custom field – "Source".
    I want WP not to show this custom field label for another post type (when I add another custom field).
    This way it would be possible to use different groups of custom fields for different custom post types.

    • Ilia, if you need that kind of customization then you'll be okay by simply removing the custom fields block from your edit post screen and use a custom metabox. And it will look cooler too ;)

  195. Useful Resources and Tutorials to get started with WordPress 3.0 | Allweb Magazine

  196. Useful Resources and Tutorials about WordPress 3.0 | All Web Magazine

  197. רושם ראשוני מוורדפרס 3 | מקום טוב באמצע הרשת

  198. I noticed that your custom columns were kind of faked for this post. How do I pull the info from the new custom inputs i created in the new post type?

    Your example pulls the ID but I cannot figure out how to pull say the length (which you simply filled in with 63:50) ?

  199. Everything You Wanted To Know About Custom Post Types — ForSite Media

  200. Hello!

    It is not working for WordPress MU? I need this funcionality.. but when I tried register_post_type function in my function.php it dont work for blogs created in WordPress with Multi-User..

    Is there any way how to make it work?

  201. 10 Greatest New Features in WordPress 3.0 to Make Your Life Easy | cnnGraphics.com

  202. Hi,

    is it possible to set a category at the custom post types automatically?
    I use the following as a try:

    "add_action('init', 'myfunc_reg');

    function myfunc_reg() {

    $labels = array(
    stuff
    );

    $args = array(
    more stuff,
    'taxonomies' => array('category')
    );

    register_taxonomy_for_object_type('category', 'my_category');
    register_post_type( 'specials' , $args );
    }"

    I want to set the checkbox for "my_category" as true (checked). But I didn't find a solution for it yet…

    Can you help me?

    Thanks in advance and greetings from Germany,
    Fabian

  203. I have the same issue as Fabian. I need to have each post of my custom post type categorized automatically. I'm thinking I may be able to write a little jQuery in the admin to check the box if nothing else. Any advice you can provide would be greatly appreciated.

    • Hi Niall,

      I came to the same conclusion and wrote a small jQuery snippet.

      This is my code in the function.php of my template:

      function specials_init(){

      add_meta_box("credits_meta", "more meta info", "specials_meta", "specials", "normal", "low");
      }

      function specials_meta() {
      … stuff

      jQuery(document).ready(function($) {
      jQuery("#categorychecklist li").each(function(i,el) {
      if(jQuery(this).html().match(/my_category_to_check/)) {
      jQuery("input",this).attr('checked','checked');
      }

      });
      });

      ("my_category_to_check" is a placeholder for your category)

      I doesn't like it cause I'd prefer a serverside solution with php/WP but it works for me.

    • Ah. I forgot the last } to close the function "specials_meta" …

      It should be:

      function specials_meta() {
      … stuff
      jQuery(document).ready(function($) {
      jQuery(“#categorychecklist li”).each(function(i,el) {
      if(jQuery(this).html().match(/my_category_to_check/)) {
      jQuery(“input”,this).attr(‘checked’,'checked’);
      }
      });
      });

      }

  204. My First Start-Up: Fight the 404 :: dunenkoff.com

  205. I know it's probably a lot to ask, but it would be amazing if you posted the source for the rental property example you are talking about.

  206. Sometimes the best way to organize is to go low-tech. Ritzenthaler uses old fashioned index cards. He marks each one with the title of a page, then lays them out on a table, rearranging until the flow of the content makes sense.

  207. Att förstå Wordpress som ett CMS | Grafix Studio - webbdesigner och grafiker

  208. Custom Post Types in WordPress 3.0 | Jay Collier

  209. I am trying to get my custom columns to show, but nothing is being pulled in with my filter. I can get the columns themselves to show with your code, but no data is being inserted. I am wondering if it is because my custom post type has a hyphen in it. Can you fill in data with a hyphen in your custom post type name?

  210. Tips & Guider till WordPress 3.0 | Wdlinköping Webbyrå.

  211. Hi Konstantin,

    Thank you so much for your explanation on the custom post types.

    But I was just trying to make one scenario work which I'm never able to do so.

    That is, I would like to create categories using the regular WP sidebar Posts->Categories and assign my custom posts types to them. For eg., I create CAT1 and SUBCAT11 (ie., under CAT1). I then create a custom post and try to assign it to SUBCAT11, which gives me a 404 error, no matter what I try. Do you think you could help me with a hint here? I'm trying to do this in you podcast-30.php file.

    Appreciate your help.

    Best,

    Andy

  212. WordPress custom post types, custom back-end columns and post thumbnails – Web Design / Development | FLDtrace

  213. Stringhäng och lördagsnörderi « sanape.se

  214. Weekly Digest, 5-17-10 | Trevor Turk

  215. Hi,
    maybe a bit off-topic, but as i see that your are pretty much expert using CPT: any idea how i can highlight a 'current_page_item' form a 'custom_page'list or why the 'wp_list_pages(post_type=xyz)' doesn't produce any class->current_page_item ?
    Thanks a lot

  216. I've never been massive however I've to admit that the iphone is quite good! :) I would wish to know if this challenge about the iphone four is important or not. I might like to buy the brand new one and I was questioning if the calls actually drop more or not. Sorry if it is a bit off topic :P Thanks

  217. Custom Post Type Tutorial Collections # WordPress Tricks & Tips

  218. Links om egne indholdstyper i WordPress 3

  219.   6 tutoriales de Custom Post Type | samuelaguilera.com

  220. October 2010, an update! | wonald.com

  221. How to List Posts in Customized Order | Submit Press Release.in

  222. 20 Free WordPress Themes from 2010

  223. 10 Great New Features in WordPress 3.0 | Best Web Magazine

  224. WordPress 3.0 in Helder Hollands | svn test

  225. WordPress Plugin: Introducing Custom Metadata Manager // digitalize.ca

  226. New Josh Wynter site goes live | Chris Bewick

  227. Custom Post Types in Wordpress 3.0 Links | Jason Lawton's Blog

  228. How to create Wordpress Custom Post Types | tutorials blogs

  229. WordPress | 日本語 » WordPress 3.0 ベータ 1

  230. The Essential Guide to WordPress Custom Post Type « Bookmark It!

  231. WordPress 3.0 Beta 1 Screenshots, Impressions – Zeke Weeks

  232. WordPress as a true custom CMS - plugins and tips - ZigPress

  233. 45+ Fresh Wordpress Tutorials | MoeMir

  234. Why Custom Post Types are Great | Bookmarks

  235. have trouble to display my custom fields in custom post type do not know how to reference the custom field – does anyone have an idea??

    Thank you in advance!

  236. Custom Content Types y Custom Taxonomies en Wordpress | Viviendo en la era digital | La Web A

  237. Har du opdateret til 3.0 | Thomas Pilegaard

  238. Nice article! One question:
    I'm localizing a theme i'm working on. The localization works fine except for the taxonomies and the custom post types. Both keep displaying in the default language.

    Anyone who can tell me what could be the reason for that? Or is not possible to localize custom post types and taxonmies?

  239. Custom Post Types למה זה טוב? | בלוג של מפתח וורדפרס

  240. Can any tell me how to make a site like imdb.com in which all links are cross referenced you can arrange movies by actor, director etc.

    I am searching for this for past 15 days there are lot of articles on Custom Post Types and Taxonmies but after implementing every article I still not able to make because there is no complete article on this!

    Plz help

  241. Wordpress 3 Delivers Much Needed Changes |

  242. Thomas Pilegaard » Har du opdateret til 3.0?

  243. Thomas Pilegaard » Har du opdateret til 3.0

  244. The 'photo post' is really great addition. I was tired of manually doing this or adding a script for it myself. WP 3 has been nice so far, but I wish the updates would slow down. Feel like a beta tester sometimes.

  245. Hi – I hope you know about the new "post types" functionality.
    see http://wordpress.tv/2011/08/29/ian-stewart-awesom

    It's a great way of customizing posts in a way that's transferable between themes. And it kinda / sorta works in a way that replaces / conflicts with custom post types.
    There might be a time when you need both, or would choose to customize post types. But I strongly suggest you watch this video … post formats are wey easy and wey good.

    –ben

Comments are closed.