Saltar navegación

[Resuelto] Editing a Toolset Views query to search in a custom field for Post Titles

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

I’m trying to work out an easy way for a client to edit a schedule for staff working on various days in a 2 week period. The end result is to be a page showing 14 fields, one for each day in a 2 week period. In each field would be a list of the staff names separated by a comma and each would should be a link to the staff member’s post.

Each staff member currently has a post with their first name as the post title in a custom post type called Models.

Solution:

You can try these:

https://toolset.com/forums/topic/editing-a-toolset-views-query-to-search-in-a-custom-field-for-post-titles/#post-2006051

Relevant Documentation:

https://toolset.com/course-lesson/many-to-many-post-relationships/

This support ticket is created hace 3 años, 9 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por barryG-4 hace 3 años, 8 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#2005675

Tell us what you are trying to do?

I’m trying to work out an easy way for a client to edit a schedule for staff working on various days in a 2 week period. The end result is to be a page showing 14 fields, one for each day in a 2 week period. In each field would be a list of the staff names separated by a comma and each would should be a link to the staff member’s post.

Each staff member currently has a post with their first name as the post title in a custom post type called Models.

To edit the schedule I am planning the following:

1. A custom post type called Schedules and within it just 2 posts named Week 1 and Week 2 and each of the posts assigned 7 single line custom fields named after the days in a week.
2. I would like the client to be able to enter manually in those custom fields, the first names of the Models followed by a comma or semi colon etc.
3. Now here’s what might not be possible......On a specific page that displays the schedule for each week is it possible to have code inside a query in a Toolset View that would be asked to search for example, the Schedules ‘Week 1’ post custom field ‘Monday’ and look for Models post titles and if it finds them, add them to the loop so the result is the list of post names with a link separated by commas.

It’s a long shot I know but might this be possible?

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?
enlace oculto

#2006051

Hello,

I assume we are talking about this case:
1) Two post types:
- schedule
- model

2) You are going to connect above two post types by a "weekday" field.

If it is, you can try these:
1) Setup many-to-many relationship between "schedule" and "model" with an intermediary post type "schedule-model"
Add a custom select(radio) field "weekday" into above intermediary post type "schedule-model":
https://toolset.com/course-lesson/many-to-many-post-relationships/

2) Edit each "schedule" post, connect it with other "model" posts, and setup the field "weekday" values

3) In each "schedule" post, you can setup a post view:
- Query "schedule-model" posts
- Setup the search form, filter by "weekday" field + related "model" posts:
https://toolset.com/course-lesson/creating-a-custom-search/
- In view's loop, display related related "model" post information
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

#2007617

Hi Luo,

Thank you for a brilliant and detailed solution. Would it be okay to keep this ticket open for at least until Monday so I can spend the next few days trying it out. Just in case I get stuck on something I'm hoping I will be able to send in a request to be answered next week.

Many thanks,
Barry.

#2007917

OK, I have marked this thread as "Waiting for feedback" status, you can update here if you need more assistance for it.

#2010813

My issue is resolved now. Thank you!