Support » Plugin: Loops & Logic » Display custom taxonomy of a looped CPT

  • Resolved codimex

    (@codimex)


    Hi! Since the retirement of CCS I’ve been struggling with L&L to achieve what I need to, in order to convert my beautiful CCSs to this new format. Sadly, the learning curve is being steepy at this stage.

    I’ve created a custom taxonomy with Pods, used in a CPT created with Pods, too. I’m trying to display the custom taxonomy term of the looped CPT. My code, very summarized, looks something like:

     <Loop type=MY_CPT paged=6 orderby=date order=desc>
       <a href="{Field url}"><Field title /></a>
       <a href="URL TO CUSTOM TAXONOMY THE LOOPED POST BELONGS TO"><Field NAME OF THE CUSTOM TAXONOMY THE LOOPED POST BELONGS TO /></a>
       <Field excerpt auto=true /><a href="{Field url}">VIEW POST</a>
     </Loop>
     <PaginateButtons />

    In CCS, displaying my custom taxonomy inside a CPT loop was as simple as:

    [taxonomy MY_CUSTOM_TAXONOMY field=link]

    :”( But I’m stuck at that point, and for a couple of days, I’ve tried every combination of taxonomy-related terminology I can think of. Please, help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • randals

    (@randals)

    @codimex I’ve been in the same situation with the learning curve on this. Particularly in the area of taxonomy. Would be so helpful if they added more code examples to the documentation.

    Keep in mind I’m still struggling with it a bit but give this a try. I’ve gotten this kind of thing to work by running a Taxonomy Term loop within the Post loop to get the relevant taxonomy.

     <Loop type=MY_CPT paged=6 orderby=date order=desc>
       <a href="{Field url}"><Field title /></a>
       <Loop type=taxonomy_term taxonomy=CUSTOM TAXONOMY post=current><a href="{Field url}"><Field title /></a></Loop>
       <Field excerpt auto=true /><a href="{Field url}">VIEW POST</a>
     </Loop>
     <PaginateButtons />
    Thread Starter codimex

    (@codimex)

    Oh, that definitely works like a charm! Thank you @randals! 😀 I was soooo close! Who could ever think that, in order to fetch a taxonomy from an already looped content you need to create a new loop inside it? That doesn’t make much sense to me. This reminds me of fetching the current logged-in user’s information. What in CCS was…

    [user avatar]

    …in L&L it becomes:

    <Loop type=user id=current><Field avatar /></Loop>

    You’re right, @randals. CCS was plenty of example codes, whereas L&L is still poor in that, and we users are struggling too much for an early stage of mastering a plugin (a coding plugin!). Just let’s see how it grows, but it seems L&L has been around for quite a bit, and honestly, I think more examples should be documented by now.

    I think I get the point of this new plugin: to create contents like you’re on a jsfiddle or codepen, with html, css and script separately. It has some good points (the AJAX pagination, for instance). I hope it turns to be as flexible or even more than CCS. BTW, looking forward an [is mobile]/[is desktop]/… equivalent in L&L!

    Plugin Author Tangible

    (@tangibleinc)

    I’m glad you figured this one out!

    This reminds me of fetching the current logged-in user’s information. What in CCS was…

    [user avatar]

    …in L&L it becomes:

    <Loop type=user id=current><Field avatar /></Loop>

    There’s been some internal debate about this syntax and whether we should provide some shortcuts.
    I’ll let Eliot explain the reasoning behind it and future plans there in more detail when he has a moment.

    Although L&L has been in the repository for a few months, it’s mostly been used internally at Tangible and hasn’t been publicized in any way until this past week.
    We’ve got a lot of content and improvements in the pipeline that we were hoping to get out before making a public announcement, but since we jumped the gun a little it’s a good time to let us know which specific examples you’d like to see first so we can prioritize what you’re most interested in seeing!

    Plugin Author Eliot Akira

    (@miyarakira)

    Hi @codimex,

    In a recent plugin update, I’ve added Taxonomy and User tags as shortcuts for getting taxonomy term and user fields.

    <Taxonomy category>
      <a href="{Term url}"><Term title /></a>
    </Taxonomy>
    
    <User avatar />
    

    Here are the documentation pages:

    https://loop.tangible.one/tags/taxonomy
    https://loop.tangible.one/tags/user

    • This reply was modified 7 months, 2 weeks ago by Eliot Akira.
    Thread Starter codimex

    (@codimex)

    Thank you so much, Eliot and all the team at Tangible, for flattening the learning curve for us. If I may…

    CCS 2020:
    [user avatar]

    L&L 2021:
    <Loop type=user id=current><Field avatar /></Loop>

    L&L 2022:
    <User avatar />

    L&L 2023:
    [user avatar]

    Don’t mind me. 🤭🤭🤭 Just a playful way to thank you, @miyarakira, for your amazing and generous work with CCS, which was/is perfect. We’re looking forward the new and exciting upcoming features in L&L to see how it goes beyond that perfection!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display custom taxonomy of a looped CPT’ is closed to new replies.