• Resolved pwsherman

    (@pwsherman)


    Hello,

    I have a template with an html structure and pods magic tags. I’ve created a shortcode to loop the template block, but the output is comma delimited lists for each magic tag. Is that clear as mud?

    Here is my template:

    <div class="team-member-block elementor-post__card">
    	<img src="{@team_members.post_thumbnail_url.medium}" alt="{@team_members.post_title}" title="{@team_members.post_title}">
    	<div class="team-member-meta">
    		<h4>{@team_members.post_title}</h4>
    		<em>{@team_members.job_title}</em><br>
    		<a href="mailto:{@team_members.email_address}"><i class="fas fa-envelop"></i>{@team_members.email_address}</a>
    	</div>
    </div>

    Here is my shortcode:

    [pods name=”country” template=”Team Member Card”]

    Thanks for your help!

    • This topic was modified 4 years, 11 months ago by pwsherman.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    What is team_members in this setup? If it’s a relationship field, you need to be EACH looping through it.

    https://docs.pods.io/displaying-pods/template-tags/each-loop-tag/

    You can also look over our “Grow Beyond Posts & Pages” Onboarding Video which explains how the Each Loop works: https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/

    If you’re getting a comma separated list, it’s because you’re traversing from the relationship into the field on the other side of the relationship and if there are multiple values, they will be returned as a list and thus displayed as a comma separated list.

    Thread Starter pwsherman

    (@pwsherman)

    Thanks for the quick respose, Jim, but I’m using a shortcode because I want to set the order. I read that I can’t set the order without using a shortcode. Yes, team_members is a related pod. I’ll try to set up the relationship in the other direction.

    • This reply was modified 4 years, 11 months ago by pwsherman.
    Thread Starter pwsherman

    (@pwsherman)

    BTW the EACH loop worked fine, but I want to sort the list. Me trying to reverse the relationship direction didn’t work. I wish that video was in bite-sized chunks. Do you have any other ideas for now?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Looping a template with a shortcode’ is closed to new replies.