简体   繁体   English

WordPress-从要显示在页面上的帖子列表中选择

[英]WordPress - Choose From A List Of Posts To Display On A Page

I am fairly experienced in the ways of WordPress but have come across something that has me stumped. 我对WordPress的方法相当有经验,但是遇到了让我感到困惑的事情。

I have a number of pages which are 'Treatments' and a custom post type called 'Staff'. 我有很多页面是“处理”和一个自定义帖子类型,称为“工作人员”。

Everytime I create a treatment I want to be able to choose 1 or more staff members who are qualified to carry out that treatment. 每次创建治疗时,我都希望能够选择一名或多名有资格进行该治疗的工作人员。

So my question is, how do I set up WordPress to allow me to select from a number of staff members? 所以我的问题是,如何设置WordPress以允许我从许多工作人员中进行选择?

What the staff post contains is essentially a profile and I want to be able to pull that into the treatment. 员工职位所包含的基本上是个人资料,我希望能够将其用于治疗。

In my mind I am envisaging it as either a series of check boxes within each of the events that displays all staff members 在我的脑海中,我设想它是每个事件中显示所有工作人员的一系列复选框

OR 要么

That might be overkill if staff numbers grow significantly and therefore maybe some kind of repeater field with a drop down that displays the staff names. 如果人员数量显着增加,那么这可能会过大,因此,某些中继器字段的下拉列表会显示人员姓名。

I know I could do this with a number of different templates for the treatments and some categories or tags attached to the staff members, but it is better to do this with one generic template. 我知道我可以使用许多不同的治疗模板以及一些附加到工作人员的类别或标签来做到这一点,但是最好使用一个通用模板来做到这一点。

All thoughts to help me towards a solution are greatly appreciated. 非常感谢所有能帮助我寻求解决方案的想法。

Thanks for your time and help in advance. 感谢您的宝贵时间和提前的帮助。

Perhaps an easy alternative solution would be to use a plugin such as this . 也许一个简单的替代解决方案是使用类似this的插件 It's for managing participants, but it also works for things like keeping track of staff. 它用于管理参与者,但也可以用于跟踪员工等。

As for putting the staff information in posts, that plugin has a shortcode [pdb_single] that will list a single person's information. 至于将员工信息发布到帖子中,该插件具有一个短代码[pdb_single] ,该代码将列出单个人的信息。 You can find out more information on shortcodes by reading the "other notes" page on the plugin page. 您可以通过阅读插件页面上的“其他说明”页面找到有关短代码的更多信息。

Super easy. 超级容易。

Create a custom function holding all of your staff members information. 创建一个包含所有职员信息的自定义功能。 When creating a new 'treatment' post, call the appropriate staff members information using the custom fields. 创建新的“待遇”职位时,请使用自定义字段致电适当的员工信息。 If the staff member is provided in the custom field, and if the staff member is found it will output the staff members information. 如果在自定义字段中提供了工作人员,并且找到了工作人员,它将输出工作人员信息。 You'll have to modified your treatment page to output the custom fields output. 您必须修改治疗页面以输出自定义字段输出。

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

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