[wp-hackers] Post/Page "Types"?

Mike Schinkel mikeschinkel at gmail.com
Sun Nov 2 10:15:07 GMT 2008


Malaiac>>  short answer : use zelist, plugin directory for wordpress (<auto
promotion> http://www.zelist.net/en/ </auto promotion>)

Thanks for the answer. 

Do you have screen shots anywhere?

BTW, I don't want to create a directory per se, I want to be able to manage
different content types. It may look superficially like a directory but that
isn't really what I want.

>> custom post_type is possible in WP but WP doesn't like custom taxonomies

Let me see if I understand by giving an example. Are you saying that I can't
create a list of categories like "Startup", "Growth", and "Mature" that
would only apply to my custom post_type "Companies?"

Okay, that's fair. I was planning to use tags for categorizing and create a
plugin where I could list of the tags that would apply. Do you think that
won't work?

-Mike Schinkel 
http://mikeschinkel.com


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Malaiac
Sent: Sunday, November 02, 2008 4:51 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Post/Page "Types"?

2008/11/2 Mike Schinkel <mikeschinkel at gmail.com>:
> Thanks for the comment Jennifer, and in general that's great advice! I 
> actually have a lot more experience with Drupal than with WordPress 
> and that's the same advice I give my clients. Sometimes I suggest 
> WordPress and other times I suggest Drupal all depending on their 
> needs and any other relevent factors.

short answer : use zelist, plugin directory for wordpress (<auto
promotion> http://www.zelist.net/en/ </auto promotion>)

long answer :
custom post_type is possible in WP
but WP doesn't like custom taxonomies

what if you want to make a categories dropdown of your custom elements ?
well, you can't

it's like each post_type was integrated after the other, adding a new line
to WP core code each time.
e.g. this pattern is very common :
if($post->post_type == 'page')  { do something to a page; } else{ do
something ASSUMING this is a post; } another exemple :
function work_on_items (imaginary function)  { let's say i need the category
of elements (for hierarchy or whatever) 90% of the time, there is an
equivalent of :
$taxonomy = 'category'; // 'category' is hardcoded !
$categories = get_categories($taxonomy); }

Worst case I think is the wp_edit_post
which calls wp_update_post,
which calls wp_insert_post()
which calls wp_set_post_categories()
which calls wp_set_objects_terms with a hardcoded string 'category' to link
the item (assuming item->post_type = post) // return
wp_set_object_terms($post_ID, $post_categories, 'category');

so basically, if you want to have a custom taxonomy for your custom
post_type - it makes sense, since you may want to have separate taxonomies
for the regular posts and the custom post_type posts - you have to duplicate
4 big functions *

so WP allows you to have custom post_type It just doesn't allow you to
display/work/manage them like regular posts/pages :)

as for zeList, I don't know if it could help you for this particular work. I
hope so. I welcome feedbacks anyway :)

Malaiac

* shameless because I spent hours and many lines of code to replicate some
WP functions see http://www.zelist.net/xref/includes/index.html and explore
zelist-*-duplicate.php files
** for example
http://www.zelist.net/xref/includes/zelist-admin-post.duplicate.php.source.h
tml
where the wp_edit_post() entire process is duplicated
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list