Support » Plugin: Posts 2 Posts » [Plugin: Posts 2 Posts] templates for p2p_list_posts

  • Resolved Manuel Schmalstieg


    Congratulations for this awesome plugin. It’s already revolutionizing my WordPress-as-a-CMS workflow.

    I would like to ask for some information regarding the “templates” that we can supposedly define for the p2p_list_posts() function.

    A reference to such templates is included in the function’s code, in /core/api.php … but there is no info yet in the official wiki:

    So I guess this feature will evolve with coming updates?

    My practical use case: at some places of my theme, I want to output a list of connected posts without the hyperlink linking to the post. Just the title. While I can define “before” and “after” markup, there seems to be no easy way to disable the hyperlink.

    For now I will simply modify the function in /core/api.php, or create a similar function. But it would be good to know more about the use of those templates.

    Another thing: I spent some time trying to apply the code given in “Looping The Loop” inside multiple loops built with WP_Query, which wasn’t giving me the expected results. Finally I understood that I should use query_posts for that, and all worked fine.
    The “Looping The Loop” article might include a little hint, for the noobs among us 😉

    Thanks again for the great work!
    PS: I created German language files, will send them your way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author scribu


    p2p_list_posts() is just a utility to avoid using a normal Loop. I’m not even sure if I should keep it around.

    As for the ‘template’ parameter, you would use it like this:

    p2p_list_posts( $connected, array( 'template' => 'some-template.php' ) );

    And in your theme, you would have to have a file called some-template.php.

    Thanks Scribu for the splendid x-mas holiday support.
    I will give the template parameter a try.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Posts 2 Posts] templates for p2p_list_posts’ is closed to new replies.