[Plugin: Posts 2 Posts] shortcode, filters and templates
-
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:
- Same view but different display
- 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 templatep2p-list-posts_to_pages.phpp2p-list-posts_to_pages-ol.phpp2p-list-posts_to_pages-ul.phpp2p-list-posts_to_pages-table.phpp2p-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.3Here 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.
The topic ‘[Plugin: Posts 2 Posts] shortcode, filters and templates’ is closed to new replies.