• Resolved Francois Lamotte

    (@francoislamotte)


    Hi Scribu,

    With the new logic of filters, I was wondering how it was possible to manage different templates for the same connexion.

    Maybe my following suggestion is out of scope and already working. As I’m not a dev, pardon my lack of knowledge on the way to code it.

    Current Shortcodes

    [p2p_connected type=posts_to_pages]

    [p2p_related type=contacts_to_societes mode=ol]

    Following my context, I need different display:

    1. Same view but different display
    2. Different elements extracted from the linked posts

    1. Same view : different display

    • List unordered
    • List ordered
    • Table
    • Grid

    If we took the mode= attribute we could point to template

    p2p-list-posts_to_pages.php

    • p2p-list-posts_to_pages-ol.php
    • p2p-list-posts_to_pages-ul.php
    • p2p-list-posts_to_pages-table.php
    • p2p-list-posts_to_pages-grid.php

    maybe more efficient with a conditional logic inside the same template 🙂

    2. Different elements extracted from the linked posts

    Sometimes, you need only a Title+Link, but elsewhere you want Title+Link+Excerpt+Thumbnail, …

    Same query but different elements to display.

    Or another more complex query

    Post = p2p link >> Pages = p2p link >> Custom Posts

    Example of display :

    Page #1 (title+link)
    — Custom-Post #1.1 (title+link+thumbnail) // Display in a table
    — CP #1.2
    Page #2
    — CP #2.1
    — CP # 2.2
    — CP # 2.3

    Here maybe we would need to point to different templates … but how to point them i the shortcode

    [p2p_connected type=posts_to_pages template=p2p-list-posts_to_pages-view_2]

    Once again, thank you for your guidance.

    http://ww.wp.xz.cn/extend/plugins/posts-to-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Posts 2 Posts] shortcode, filters and templates’ is closed to new replies.