简体   繁体   中英

Pods Plugin Display Custom Taxonomy with Magic Tags on Pods Template

So I am using the Pod Plugin for my WordPress Website. And I want to use magic tags to display a custom taxonomy of a pod.

Little background info:

  • I have 2 pods (Projects & Programmes)
  • I have field in Projects to Select a Programme (Each Project belongs to one Programmme)
  • In my Programme Pod, I have a custom taxonomy called 'colour'. (Basically i need this for my CSS)

So i am using a pod template to display my recent projects. but with that I want to assign a custom color line on the side when each project is posted. (see image below)

Design of the recent post display

So in my sass file i have ready the code like:

.green-bg{
  background-color: #659E80;
}

.mustard-bg{
  background-color: #E3A44C;
}

.blue-bg{
  background-color: #2B7BBF;
}

i want taxonomy select to be display in the class of the div side-line. for example:

<div class="side-line blue-bg"></div>

I want this to be dynamic and using magic tags like:

<div class="side-line 
[each colour]
{@programme.colour}
[\each]
bg"></div>

This syntax is invalid. It is just a example of what I want to achieve. Also another note is the template is Pod Referencing Project pod.

Pods Template for Recent Projects:

div class="recent-post-container">
    <div class="side-line"></div>
    <div class="post-group">
        <p class="recent-post-title">{@post_title}</p>
        <p class="recent-post-programme">{@programme}</p>
    </div>

</div>

Please help. If you can solve this or find another way i can dynamically assign colors to the div based on the programme being displayed.

Update. I manually put in the colors as a field with a relationship as type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM