[Plugin: Posts 2 Posts] Can't get example to work
-
Hi,
Thanks for another great plugin, the possibilities of P2P are great. But I’m having some trouble making it work.
I did the following, on a blank WP (3.1.1) and P2P (0.7), my PHP version is 5.3.3 :
Created a custom post type named : publications
Then in functions.php :
function my_connection_types() { if ( !function_exists( 'p2p_register_connection_type' ) ) return; p2p_register_connection_type( array( 'from' => 'publications', 'to' => 'page' ) ); } add_action( 'init', 'my_connection_types', 100 );
and in page.php :
$connected = new WP_Query( array( 'post_type' => 'publications', 'connected_from' => get_queried_object_id() ) ); echo '<p>Related posts:</p>'; echo '<ul>'; while( $connected->have_posts() ) : $connected->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; echo '</ul>'; wp_reset_postdata();
This is exactly the examples from the wiki, I just adapted it to a custom post type. But it doesn’t work, all it shows is : “Related posts:”
Am I missing something ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: Posts 2 Posts] Can't get example to work’ is closed to new replies.