简体   繁体   English

Pods 插件在 Pods 模板上显示带有魔术标签的自定义分类法

[英]Pods Plugin Display Custom Taxonomy with Magic Tags on Pods Template

So I am using the Pod Plugin for my WordPress Website.所以我正在为我的 WordPress 网站使用 Pod 插件。 And I want to use magic tags to display a custom taxonomy of a pod.我想使用魔术标签来显示 pod 的自定义分类。

Little background info:小背景资料:

  • I have 2 pods (Projects & Programmes)我有 2 个豆荚(项目和计划)
  • I have field in Projects to Select a Programme (Each Project belongs to one Programmme)我在项目中有字段到 Select 一个程序(每个项目属于一个程序)
  • In my Programme Pod, I have a custom taxonomy called 'colour'.在我的 Program Pod 中,我有一个名为“颜色”的自定义分类法。 (Basically i need this for my CSS) (基本上我的 CSS 需要这个)

So i am using a pod template to display my recent projects.所以我使用 pod 模板来显示我最近的项目。 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:所以在我的 sass 文件中,我准备了如下代码:

.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.我希望分类法 select 显示在 div 侧线的 class 中。 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.另一个注意事项是模板是 Pod 引用项目 pod。

Pods Template for Recent Projects:最近项目的 Pod 模板:

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.如果你能解决这个问题或找到另一种方法,我可以根据正在显示的程序将 colors 动态分配给 div。

Update.更新。 I manually put in the colors as a field with a relationship as type.我手动将 colors 作为具有关系类型的字段放入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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