Posts 2 Posts – List Connections

<?php
/**
* List Speakers
* Used on Schedule page to list speakers connected to session
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/posts-2-posts-list-connections
*/
function be_list_speakers() {
if( function_exists( 'p2p_list_posts' ) ) {
$connected = p2p_type( 'sessions_to_speakers')-> get_connected( $post->ID );
p2p_list_posts( $connected, array(
'before_list' => '<p>by ',
'after_list' => '</p>',
'before_item' => '',
'after_item' => ' ',
) );
}
}
view raw gistfile1.aw hosted with ❤ by GitHub

Posts to Posts

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk