• Hi Guys,

    I’m trying to display a list of 5 random ‘related’ posts based on the custom taxonomy of the post that’s being viewed.

    For example, when a visitor is viewing an profile post (custom post type ‘profile’) that has been assigned to the ‘bio’ taxonomy (custom taxonomy slug ‘profile_category/bio’), I want to output 5 random ‘bio’ posts in an unordered list.

    The code needs to sit within the loop of the single-profile.php template.

    Any help would be hugely appreciated!

    Thanks in advance!

    Note: custom taxonomy is being recorded in the post and post custom type

    example: the film has custom taxonomy Sixty Seconds Angelina Jolie, clicking on it will post for custom type that has the biography of Angelina Jolie, I wish that this type custom post appeared every post that contains the custom taxonomy Angelina Jolie.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter m4z1nh0

    (@m4z1nh0)

    Anyone?

    Thread Starter m4z1nh0

    (@m4z1nh0)

    Anyone?

    To create secondary loops, make a new instance of WP_Query with the desired parameters:

    // Create a new instance
    $second_query = new WP_Query( 'tag=foo' );
    
    // The Loop
    while( $second_query->have_posts() ) : $second_query->the_post();
    	echo '<li>';
    	the_title();
    	echo '</li>';
    endwhile;
    
    wp_reset_postdata();
    Thread Starter m4z1nh0

    (@m4z1nh0)

    Unfortunately it did not work, showed the latest blog posts that have not reported the monster post taxonomy used.

    Triple P, below the code that I use today to demonstrate the post related post, would modify custom pora post? would be very grateful if you can.

    Thanks for the help so far.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter m4z1nh0

    (@m4z1nh0)

    Anyone?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘help with post type’ is closed to new replies.