[wp-hackers] Post to Posts and Taxonomies Relations

Sinan sinan at sinanisler.com
Thu Jul 12 22:32:39 UTC 2012


Thats important

you need to add custom posts this taxonomy relational


function singer_init() {
register_taxonomy(
 'singer',
array('*music*','*singer*','*album*'), // relational custom posts
 array(
'label' => __( 'Singer Name' ),
'rewrite' => array( 'slug' => 'singer' )
 )
);
}
add_action( 'init', ' singer_init' );




2012/7/13 Sinan <sinan at sinanisler.com>

> Hello  Joaquin ,
>
> I recently made a short tutorial for this but its turkish. I learn for my
> new project ım coding now its like social artist database its like imdb but
> for Singers.
>
> Any way here is my tutorial
> http://www.codeprex.com/wordpress-ozel-yazi-bicimi-custom-post-type-ve-taxonomy/
>
> I'm gonna tell you little bit how its works.
>
> first you need create custom post or posts you can see article how I add.
>
> and for relationship you must add taxonomy.
>
> for example ;
>
> Singer (Custom Post)
> Album (Custom Post)
> Music (Custom Post)
>
> And most important
>
> Singer (Taxonomy)
>
> with this structure you can get relational content how ? easy;
>
>
>
> $args = array(
> 'post_type'=> 'music', // custom post slug
>  'singer'    => 'eminem' // taxonomy slug
> );
> query_posts( $args );
>
> with this code you can get musics for eminem. (if you dont know query
> posts and wp query learn them important !)
>
>
> for translate I have no idea I dont try that. I use WPML its works with
> custom posts.
>
>
>
> 2012/7/12 Joaquin Rodriguez Montero <yojoaquin at gmail.com>
>
>> Hi guys, could you help me out and shed some light over this stuff please?
>> I have disciplines and cases post types. Both are linked via scribu's
>> post2post plugin.
>> Now I'm on Disciplines page and I have to link them to "Related Cases".
>> When clicked it will take me to the page with cases of the selected
>> discipline.
>> At the same time on that filtered last page I have a list of disciplines
>> that act as a filter. So I'm viewing "Integrated Branding" cases and on
>> the
>> sidebar I also have a list of other disciplines. How would you do it "the
>> WP" way? "Easiest" solution would be to do it via query string but then
>> the
>> pagination wouldn't work well probably plus I'm using qTranslate plugin
>> which adds "?lang=es" for instance for translated content..
>>
>> Any ideas?
>>
>> Thanks!
>>
>> Joaquin
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> Sinan İŞLER
> sinanisler.com <http://www.sinanisler.com>
> fb.com/sinanisler
>
>


-- 
Sinan İŞLER
sinanisler.com <http://www.sinanisler.com>
fb.com/sinanisler


More information about the wp-hackers mailing list