[wp-hackers] Custom Post Type

Dan Larkin nitephire at gmail.com
Sun Jan 27 22:45:15 GMT 2008


Well, that fixes one problem but creates another.  I created a simple test
plug-in to run the following code in a function applied by the posts_where
hook:

if ( !is_admin() ) $where = eregi_replace ("post_type = 'page'", "(
post_type = 'page' OR post_type = 'group' )", $where);

This does make it so that WP will display.  However, I think basically it
eliminates distinctions.  Under both 'Manage Pages' and 'Manage Posts' all
records of the posts table are returned.  Any idea why that would happen?

On 1/27/08, Austin Matzko <if.website at gmail.com> wrote:
>
> On Jan 27, 2008 4:51 PM, Dan Larkin <nitephire at gmail.com> wrote:
> > I do not want these special pages to show up under Manage Pages or
> Manage
> Posts.  I do want them to show up when one navigates to the pages'
> permalinks.
> [snip]
> > Again, correct me if I'm wrong, but it
> > seems like using set_query_var() will return only those posts which are
> of
> > the special value when used in a separate query.  This isn't what I want
> to
> > do at all.  I want the main query that handles usual post and page
> display
> > to simply get a little extra code functionality to display posts with
> other
> > 'post_type' values.
>
> So you want posts of both post_type "post" and post_type "group" to be
> included together? Then I would use the 'posts_where' filter to call
> back a function where a regular expression replaces post_type = 'post'
> with (post_type = 'post' OR post_type = 'group').
>
> To keep the admin area from being affected, just test with
> "is_admin()" before applying the filter.
> _______________________________________________
> 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