WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
Connexions don't show (2 posts)

  1. tiwelle
    Member
    Posted 1 year ago #

    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;?>`

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. tiwelle
    Member
    Posted 1 year ago #

    FYI, connections are showing on auteur single.php, but not in my product-single.php
    It's a mystery, I really don't understand... Please help...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic