WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
How to use it in single-(post-type).php (3 posts)

  1. AliMH
    Member
    Posted 3 years ago #

    hi,
    i wanna use this plugins as by taxonomy related posts, is there any function that i can call within my single post type file to get taxonomy related posts (base on genres or ...) ?

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    You could do something like this (not tested):

    $current_genre = reset( wp_get_object_terms( $post->ID, 'genre' ) );
    
    $related = new WP_Query( array( 'genre' => $current_genre->slug ) );
    
    while( $related->have_posts ) : $related->the_post();
    // display related post
    endwhile;

    Otherwise, you might be better off with a plugin like YARPP.

  3. mistercyril
    Member
    Posted 3 years ago #

    YARPP doesn't support custom Post types at the moment... bummer :-(

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic