Connexions don't show
-
Hello,
I’m trying to display the connection between books (product woocommerce post type) and authors (custom post type) on both authors and books page, but I can’t seem to male it work. Connection boxes appear on both admin pages, but impossible to get anything displayed on front end. I tried to put the WP_Query inside the loop, outside the loop, after a reset query tag… Please help ? My connection is called livres_auteur, and here is the code I’, trying to use on my books page.
` <?php
// Find connected authors
$connected = new WP_Query( array(
‘connected_type’ => ‘livres_auteur’, // the name of your connection type
‘connected_items’ => get_queried_object(),
‘nopaging’ => true,
) );// Display connected authors
if ( $connected->have_posts() ) : ?>
<h3>Auteur</h3>
<ul>
<?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php
// Prevent weirdness
wp_reset_postdata();
endif;?>`
- The topic ‘Connexions don't show’ is closed to new replies.