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

Malaiac malaiac at gmail.com
Sun Nov 2 09:50:38 GMT 2008


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.html
where the wp_edit_post() entire process is duplicated


More information about the wp-hackers mailing list