Include a connected CPT post to regular post loop
-
Hello, I’m quite a newby on WP and Posts2Posts plugin. I’ve checked in previous forum posts but I can’t find what I need (but – if exist – maybe someone could link me to it). Here’s my problem :
I’ve got a CPT featuring profile of manufacturers. Then I’ve got a normal news section of regular posts, where I’de like to connect each single news to the profile connected. Here’s what it should look like:
<ul> <li> <span><a href="link-2-cpt-profile-post">profile-name</a></span> <h2><a href="link-2-regular-post">news-title</a></h2> </li> <li> <span><a href="link-2-cpt-profile-post">profile-name</a></span> <h2><a href="link-2-regular-post">news-title</a></h2> </li> <!--etc--> </ul>
I’ve created the following code and it works:
function profiles_2_posts() { p2p_register_connection_type( array( 'name' => 'profile_2_post', 'from' => 'cpt_profiles', 'to' => 'post', 'reciprocal' => true, 'duplicate_connections' => true ) ); } add_action( 'p2p_init', 'profiles_2_posts' );
But now I can’t figure out how to create the loop to create the list above.
Any help is appreciated.
Thanks
Paolo
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Include a connected CPT post to regular post loop’ is closed to new replies.