• Resolved justinleemackey

    (@justinleemackey)


    Hello,
    I need some help using the shortcode [pods] to dynamically display the featured image of a custom post based on bi-directional relationship pods.

    Setup:
    I created two pods 1) User extension bi-directional that links to a custom post type, called ‘Team Members’.
    2) Post Type extension for post type ‘Team Member’ bi-directional that links to the WordPress User.
    3) ‘Team Member’ posts have featured images.
    4) Each WordPress User has a ‘Team Member’ post with their name as the title, included Bio, and an selfie set as the featured image.

    Now either on the WP User or within a post of the ‘Team Members’, I can select the WordPress User on the post or the Team Member on the user to link them using dropdown, thereby linking each user with their associated Team Member post that contains their Bio and photo set as the Featured Image.

    My goal here is to set blog posts in WordPress to particular Authors or WP Users. The blog posts are calling a header template I created that display the Title and Author’s (wp User) name, which is pretty typical. Now that each User is associated with a Team Member post, what would need to be included in [pods] shortcode to dynamically display the associated Team Member featured image in the header template?

    Any help is greatly appreciated!

    Justin

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @justinleemackey

    Before going into this further, why do you use custom post types for the user bio etc? Why not just use the user profile for this?

    Anyway, for getting the correct data, please check our magic tags: https://docs.pods.io/displaying-pods/magic-tags/

    Getting values from related items can be done like this: [pods field="relationship.field"]. For the featured image it would be: [pods field="relationship.post_thumbnail.size"]

    Cheers, Jory

    Thread Starter justinleemackey

    (@justinleemackey)

    Hi Jory,
    we use the custom post type because it allows for our team / practitioners / stakeholders to have nice individual team detail pages, such as: https://integration.maps.org/jennifer-smee/

    In this way, I’ll be able to display their photo on blog post headers and have it link to their detail page dynamically.

    Thanks for the reply, I’ll try it out !

    Justin

    Thread Starter justinleemackey

    (@justinleemackey)

    Hi again,
    it seems that any iteration I use such as [pods field="team_member_pod.wordpress_user.display_name"] (which should show the authors display name) on the header of the blog post with an associated Author, it display “Pod not found”. I wonder if this is due to the shortcode being displayed on a regular post?

    Thanks,
    Justin

    Thread Starter justinleemackey

    (@justinleemackey)

    Moving this to the slack channel.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Such traversals are not supported for multiple relations. Only single relationships can be traversed like that.
    For multiple relations you should look at the [each] tag in Pods Templates.
    https://docs.pods.io/displaying-pods/template-tags/each-loop-tag/

    Cheers, Jory

    • This reply was modified 4 years, 8 months ago by Jory Hogeveen.
    Thread Starter justinleemackey

    (@justinleemackey)

    Hi Jory, there is only a single relationship happening, Team Member post type linking to WordPress User. The Team Member post type is not a pod created post type though since I was using it before I installed Pods.
    Name of each pod:
    jv_team_membersPost Type (extended)
    userUser (extended)

    Is it possible to take a regular blog post and show the author’s (wordpress user) of the blog post featured image of the team member post type that’s linked through the pods relationship? Maybe i’m not fully groking the way pods works.

    Thanks,
    Justin

    Plugin Author Jory Hogeveen

    (@keraweb)

    Ah ok, in that case it should work.

    If you are on a jv_team_members page then this would be your notation: [pods field="relationship_field_name.relationship_field"]. Example: [pods field="rel_user.display_name"]

    Hope this helps,

    Cheers, Jory

    Thread Starter justinleemackey

    (@justinleemackey)

    Jory, thanks for the reply. The dilemma is, i’m not working in a jv_team_member post. I’m working in a post of the posts post type. Each post in posts has an Author, which in turn has a related jv_team_member. Is it not possible to use pods to show the featured image of a jv_team_member post on a posts post, via the Author relationship?

    Thanks,
    Justin

    Thread Starter justinleemackey

    (@justinleemackey)

    Realizing this is a bit more complicated and may need a template made versus just using [pods] shortcode since I’m trying to call the associated authors / wp users jv_team_memeber post, featured image on a post of the posts post type, which has not relationship other then the associated author which posts have natively. I imagine the pods template would have to loop through each wp user as well as each team member post to display only their image. What would a pods template consist of to achieve this? Thanks very much!

    Plugin Author Jory Hogeveen

    (@keraweb)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Display feat. img of custom post type dynamically on blog post header template’ is closed to new replies.