Hi,
I was wondering if anyone could help me with this problem:
I have a post type ‘Project’. Each ‘Project’-post has one or more ‘Participant’ connected to it by relationship field. I want to make a filter on the archive page for ‘Projects’ so the user can see ‘Projects’ with one spesific ‘Participant’.
Is this possible?
I have this:
<select class=”js-category left”>
<option value=”all” >Alle</option>
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
$posts = get_field(‘deltagere_prosjekt’);
if ( $posts ) :
foreach ( $posts as $post) :
$postidkunde = ($post->ID); ?>
<option value=”<?php echo $postidkunde; ?>”>
<?php echo get_the_title( $postidkunde ); ?>
</option>
<?php
endforeach;
endif;
} // end while
} // end if
?>
</select>
But – when I use this ‘Participent 1’ get listet two times because his connected to both Procjet 1 and ‘Procjet 2’ – how to avoid that?