WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
Error when inside wp_query (1 post)

  1. Dustin Jones
    Member
    Posted 1 year ago #

    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>

    <?php
    // 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; ?>

    <?php
    // Prevent weirdness
    wp_reset_postdata();

    endif;
    ?>

    <?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.

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic