• Hi,

    I am very new to taxonomy ..just read on this and have some idea on this

    what i want to know is how to filter posts to be shown on that taxonomy page

    For ex i have a taxonomy actor and i have assigned tom cruise to it

    i am ok with showing posts which has the same tom cruise term … but i want to filter posts according to category as well

    i mean i need to show posts which are from category “gallery” and has term tom cruise in it

    any ideas ? pls tell me thinking me as a noob ….

    Thanks in advance

    with regards
    sribharath

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter sribharath

    (@sribharath)

    ho bump ….

    Thread Starter sribharath

    (@sribharath)

    no one ?

    use query_posts('gallery=tom');

    I believe that you will need to use a filter to add the custom taxonomy to the query. AFAIK, WP does not currently allow both a category and custom taxonomy term in the query args.

    function mam_posts_join ($join) {
       global $mam_global_join;
       if ($mam_global_join) $join .= " $mam_global_join";
       return $join;
    }
    
    $mam_global_join = "JOIN $wpdb->term_relationships tr
       ON (tr.object_id = $wpdb->posts.ID)
       JOIN $wpdb->term_taxonomy tt
          ON (tt.term_taxonomy_id = tr.term_taxonomy_id
             AND tt.taxonomy = 'actor')
       JOIN $wpdb->terms t
          ON (tt.term_id = t.term_id AND t.name = 'Tom Cruise')";
    query_posts('category_name=gallery');

    Of course, you will probably need to add other parameters to your query_posts such as for pagination.

    try this once query_posts('gallery_name=tom');

    Thread Starter sribharath

    (@sribharath)

    will give a try ..Thanks for letting me know ..will get back if i have any issues

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘a question on taxonomy’ is closed to new replies.