• Resolved djdefenda

    (@djdefenda)


    Hi,

    I made a Pods Template to display my custom post type, I have listed the skills, styles and other taxonomies so they display as a link ( Thanks to the instructions found here; https://pods.io/forums/topic/get-related-post-link-in-template/)

    As you can see on my website page that I linked all the links are working EXCEPT for the ‘Artist Type’ section and the ‘Started In’ section.

    I have tried many times and I am completely at a loss as to why I can’t get those 2 fields to display!

    I will paste my template below;

    <p>STATE: [each states]
    {@states.name}
    [/each]</p>

    <p>ARTIST TYPE: 
    [each artist_type]
    {@artist_type.name}
    [/each]</p>

    <p>MEMBER OF: [each members]
    {@post_title}
    [/each]</p>

    <p>SKILLS:  [each artist_skills]
    {@artist_skills.name}
    [/each]</p>

    <p><p>STYLES  [each styles]
    {@styles.name}
    [/each]</p>

    <p><p>TOPICS [each topics]
    {@topics.name}
    [/each] </p>

    <p><p>STARTED IN:  [each started]
    {@started.name}{@started.slug}
    [/each]</p>

    <p><p>ERA:  [each eras]
    {@eras.name}
    [/each]

    <p><p>COLLABORATED WITH: [each collaborated_with]
    {@post_title}
    [/each] </p>

    <p><p>FAVOURITES: [each favourite_artists]
    {@post_title}
    [/each]</p>

    <p><p>INFLUENCES:  [each influences]
    {@post_title}
    [/each]</p>

    <p><p>SOUNDS LIKE:  [each sounds_like]
    {@post_title}
    [/each]</p>

    <p><p>DEDICATIONS(R.I.P.) TO:  [each artist_rip]
    {@post_title}
    [/each]</p>

    <p><p>ETHNICITY: [each ethnicity]
    {@ethnicity.name}
    [/each] </p>

    oh, and lastly, can the fields be comma seperated? If you see my ‘Topic’ field for example, they are all listed as one long word with no spacing.

    Thanks You

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter djdefenda

    (@djdefenda)

    I figured it out – was a fairly basic error;

    I just had to remove the [each] statements from the 2 fields.

    I’ll mark this as resolved and search the forums for a solution with inputting commas.

    Plugin Contributor Jim True

    (@jimtrue)

    actually the correction is to remove the field name from in front of the .name inside the each. The each is used to loop through the relationship field, taxonomy or attached file so when you’re inside it, you’re actually at the level _of_ the traversal, so adding the field in front of .name pulls you out of the loop.

    So instead of:

    
    [each styles]
    {@styles.name}
    [/each]
    

    You’d do:

    
    [if styles]
    <p><strong>Styles</strong>:</p>
    <ul class="styles-list">
    [each styles]
    <li><a href="{@permalink}">{@name}</a></li>
    [/each]
    </ul>
    [/if]
    

    That way if there were no styles defined, you wouldn’t even output that section, or you could add an elseif in there and say ‘No Styles Defined’.

    Also, if you want to make commas, make your list an inline-block with CSS and add content :after for the commas and remove it on the last one:

    
    ul.styles-list li {
        list-style: none;
        display: inline;
    }
    .styles-list li:after {
        content: ", ";
    }
    .styles-list li:last-child:after {
        content: "";
    .styles-list li:last-child:before {
        content: "and";
    }
    
    Thread Starter djdefenda

    (@djdefenda)

    Thank You.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Template Formatting/Links’ is closed to new replies.