Problem:
How to output a field from a parent post when displaying posts using the Essential Grid plugin?
Solution:
To display fields from the post itself you can use Views shortcodes in this format:
[wpv-post-title id='%post_id%'] [php] To display a field from a related post (e.g. parent) it is necessary to create a custom shortcode that uses the relationships API to query the related post, like this example for a post link: [php] add_shortcode( 'related_link', function( $atts ){ $pid = $atts['id']; $related_id = toolset_get_related_post( $pid, "artist-release", "parent" ); $output = wpv_do_shortcode( "[wpv-post-link id='" . $related_id . "']"); return $output; });
which you can then insert into a template, like so:
[related_link id='%post_id%']
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 11 replies, has 2 voices.
Last updated by 6 years, 6 months ago.
Assisted by: Nigel.