Hello,
I am running into an issue when trying to display sponsors who are connected with events created using the Events Calendar module.
In functions.php, the p2p connection is registered as follows:
function event_sponsors() {
p2p_register_connection_type( array(
'name' => 'sponsor_to_tribe_events',
'from' => 'sponsor',
'to' => 'tribe_events',
'admin_box' => array(
'show' => 'any',
'context' => 'advanced'
)
));
}
add_action( 'p2p_init', 'event_sponsors' );
And in the Event Calendar's overridden single template:
<?php
$args = array(
'connected_type' => 'sponsor_to_tribe_events',
'connected_items' => get_queried_object(),
'nopaging' => true
);
$connected = new WP_Query($args);
?>
<?php if ( $connected->have_posts() ) : while ( $connected->have_posts() ) : $connected->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div>
<?php endwhile; else: ?>
<p><?php _e('Interested in sponsoring?'); ?></p>
<?php endif; ?>
Am I missing something? When I view an event post, I can add/manage sponsors without a problem so I know the p2p connection is registered.
The debug bar is throwing the following error "Operand should contain 1 column(s)."
Thanks so much!