[wp-hackers] Custom Post - implementation specifics

Alex Dunae alex at dunae.ca
Fri Dec 4 18:00:09 UTC 2009


On Dec 3, 3:08 pm, Stephen Rider <wp-hack... at striderweb.com> wrote:
> Eric -- this suggests a good approach.  Instead of one mega-"add edit page" function, perhaps simply make it so every stock edit page element has a small function that creates it.  Thus the code that creates the standard Edit Post page might simply look like:
>
> create_editor();
> create_excerpt_box();
> create_custom_field_box();
> create_pingbacks_box();
> ...etc.

I would definitely appreciate this.  I've used custom post types in
the past and ran into a lot of issues trying to include WP's editor
(notably trying to figure out which scripts and stylesheets to
enqueue), as well as keeping the my admin boxes visually consistent
with WordPress's look and feel.

Custom post types need to be in the template hierarchy.  I.E.
post_type = 'album' looks for 'album-slug.php', 'album-ID.php',
'album.php' in the theme.

The other area I've had difficulties is hacking WP's search function
to look for custom post types.  This may have been improved over the
past year, but previously it was a real pain.  I borrowed a lot of
code from http://www.semiologic.com/software/search-reloaded/ to get
proper, paginated search working.


More information about the wp-hackers mailing list