Can't get it working.
-
Hello guys,
I’m developing a website but i’m running into some problems.
I have 2 custom post types : Producten and Clients. I made a connection between those 2 in functions.php:function my_connection_types() {
p2p_register_connection_type( array(
‘name’ => ‘client_to_products’,
‘from’ => ‘klanten’,
‘to’ => ‘producten’
) );
}
add_action( ‘p2p_init’, ‘my_connection_types’ );Then on my template where i got post ‘klanten’ (Clients) my connection seems to work fine. But when i go to single-klanten.php
i won’t get it working:
<?php
$connected = new WP_Query( array(
‘connected_type’ => ‘client_to_products’,
‘connected_items’ => array(get_the_id()),
‘nopaging’ => true,
) );
if ( $connected->have_posts() ) :
?>-
<?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
- <?php the_title(); ?>
<?php endwhile; ?>
<?php else: ?>
<p>geen producten gevonden gevonden</p>
<?php
wp_reset_postdata();
endif;
wp_reset_query();
?>The link if it helps:
http://www.icreative.nl/klanten/akzonobel/
The topic ‘Can't get it working.’ is closed to new replies.