Support » Plugin: Posts 2 Posts » Error when inside wp_query

  • So I know that I’m missing something simple here.

    I have successfully connected the post type “webinar” to “speakers” and called the connection “webinar_speakers.” This works fine. But on the webinars page, I am using wp_query to pull in the webinars and I need to show the speaker within the pulled content. When I put the code within wp_query, it returns this error:

    Warning: Could not find direction(s). in /home/meetingj/public_html/wp-content/plugins/posts-to-posts/core/query-post.php on line 16

    Here’s the code I have in there now:

    `<?php $my_query = new WP_Query(‘post_status=future&post_type=webinar’); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

    <a href=”<?php the_field(‘link_to_live_webinar’); ?>”><?php the_title(); ?></a>

    // Find connected pages
    $connected = new WP_Query( array(
    ‘connected_type’ => ‘webinar_speakers’,
    ‘connected_items’ => get_queried_object(),
    ‘nopaging’ => true,
    ) );

    // Display connected pages
    if ( $connected->have_posts() ) :
    <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
    <a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a>
    <?php the_post_thumbnail(‘thumbnail’, array(‘class’ => ‘alignright speakerthumb’)); ?>
    <?php endwhile; ?>

    // Prevent weirdness


    <?php wp_reset_query(); endwhile; ?>`

    Plugin is functioning perfectly fine in every other facet of the site, just erring inside wp_query. Thank you for any help with this.

  • The topic ‘Error when inside wp_query’ is closed to new replies.