[wp-testers] custom post type permalinks
Frank Bueltge
frank at bueltge.de
Wed May 19 10:10:26 UTC 2010
@mike: no, this also a taxonomy to my own post_type. I see not, how this
works for active permalinks.
@otto: thanks for your informations, also the post on your blog! I
understand post_types, its also an new type in the tabel posts. I had use
before this with own code for different types. Now i will play with the
functions from WP for use own post_types.
My problem is only simpel, i thnik ;)
I had add a new post_type, see mail below. I have a admin-area for this,
automaticly from WP - great. When i use the link to "View" post, then works
this great without active permalinsk, example-url:
http://localhost/wpbeta/?iphone=custom-post-type-test
the same works not with active permalinks (structure:
/%post_id%/%category%/%postname%/), also example-url:
http://localhost/wpbeta/iphone/custom-post-type-test/
Why it is not possible to use the default-url?
I understand, that the posttype not automaticl in the loop, feed and other,
this is my work for an own type.
for include the loop use th follow source, example:
add_filter( 'pre_get_posts', 'fb_get_posts' );
function fb_get_posts( $query ) {
if ( !is_admin() )
$query->set( 'post_type', array( 'post', 'iphone' ) );
return $query;
}
for the feed:
add_filter('request', 'fb_feed_request');
function fb_feed_request($content) {
if ( isset($qv['feed']) )
$content['post_type'] = get_post_types();
return $content;
}
Thanks for your times!
On Tue, May 18, 2010 at 8:00 PM, Otto <otto at ottodestruct.com> wrote:
> On Tue, May 18, 2010 at 12:53 PM, Otto <otto at ottodestruct.com> wrote:
> > "Custom Post Types" are NOT "Posts". Think of them more like Pages.
> > They're more like Custom Content Types, really.
>
> Oh, with all that said, if you just want the year in the slug, it might
> work.
>
> array ( 'slug' => '/podcast/%year%' )
>
> Note that just using '%year%' would very much NOT work. There must be
> some URL prefix difference between a "post" and your custom type...
> That URL difference is necessary for the rewrite system to know the
> difference in what to look for.
>
> Basically, if I gave it a URL of "/2010/some-name", then the rewrite
> system needs to figure out, just from that text and the rewrite rules
> alone, what post type to look for in the database.
>
> -Otto
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>
More information about the wp-testers
mailing list