Show related posts via category and post ID (1 post)

  1. joeriwetters
    Posted 2 years ago #

    Ok there we go.

    I've got a custom post type 'Directors'
    On the single-directors page i would like to show the customs post types 'Films' for each director. The 'Film' has the directors name as category (i know not the best thing).

    Is there a way to get the category_name to show the directors names dynamic??

    This is the code:

    <?php $args = array( 'post_type' => 'project', 'category_name' => 'director-name', 'posts_per_page' => 3 ); ?>
    		<?php $loop = new WP_Query( $args ); ?>
    		<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    		   <?php the_post_thumbnail('thumbnail'); ?>
    		<?php endwhile;?>

    So again to be clear;
    I would like the director-name to be the post_ID (they are always the same), so that the thumbnails from each film made by that director shows up..

    Hope someone can help!
    Thanks in advance,


Topic Closed

This topic has been closed to new replies.

About this Topic