Skip Navigation

[Resolved] Create search within search

This support ticket is created 7 years ago. 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 2 voices.

Last updated by Ido Angel 7 years ago.

Assisted by: Shane.

Author
Posts
#593547

Hi,

I have an online video courses site.
Each course has many lessons, each lesson has many videos.
A course is the parent of a lesson, and a lesson in a parent of a video.

I want to create a search form which will locate a single video within a lesson within a course.

Each lesson has a custom field of "lesson-title", so that i can filter by it. Each video has a custom field "video-title", for the same reason.

Thing is, I can't create a search form to include 2 consecutive filters of "lesson title" and then "video title", because they are different post types.

I also tried to create one search by "lesson title", and then, within the results view, create a new search by "video title" - but failed, since i want both to "show only available inputs" and this creates a conflict and makes the parent "lesson title" search just disappear.

Any ideas on how i can achieve that?

it can either be:

1. the entire search is in 1 view, e.g a search of a video-title within a lesson-title
2. separate searches - 1 for lesson-title then within the result a filter for videos by video-title

thanks!

#593595

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ido,

Thank you for contacting our support forum.

To get this straight you want to the user to search for the Video title and Lesson title as well in one search correct?

So you want both to be displayed ?

Please let me know.

Thanks,
Shane

#593599

hey
yea, something like that!
thx 🙂

#593603

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ido,

This wouldn't be possible by just searching for name. The only way I can think of this working is by creating the search for the Course and Lessons on some common element between both.

Lets say the Parent Video and the Child lessons are attached to the same taxonomy, then this will work. Another way is if the Parent/Child have the same words in the title .

For e.g we have the parent title "Videos on Tomatoes" and then the lessons would be named "How to Slice Tomatoes" or "Using Tomatoes in a sandwich" This way the user can search for the text "Tomatoes" and it will show information for anything with Tomatoes.

Please let me know if this helps.
Thanks,
Shane

#593615
sample2.jpg
sample.jpg

thx Shane 🙂

I think I didn't explain myself right.
I want to either have
1) a parametric search with 2 dropdowns (choose lesson + choose video in lesson) - see 1st image
OR
2) a sort of widget-like list to achove the same - see 2nd image
either way, the results will display the video. i don't want a free text search. just to locate the video within a lesson.

thanks!
ido

#593631

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ido,

I see what you are trying, the visual approach allowed me to understand better.

Ok so we can get the sidebar relatively easy by using 2 views in a nested format.

Take a look at our documentation below on how to achieve this.
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

So first you will create a View that will list all the Videos, then add a query filter to that view. The query filter should the a filter for Parent parent.

Then when the filter is added, select "Parent is the current post in the loop"

When that is done then you will create the View for lessons and then add that Videos view to the Lessons view and it should display in the format you want.

If you need further help setting up this please let me know.

Thanks,
Shane

#593633

thanks shane, but that wouldn't work.
the video is not a taxonomy, it's a cpt. not sure how i can set parent of parent with cpt.

#593634

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ido,

I see that you are using 2 CPT so it essentially the same process however the Videos view will be the only view that the filter is added to as explained here .

"So first you will create a View that will list all the Videos, then add a query filter to that view. The query filter should the a filter for Parent parent.

Then when the filter is added, select "Parent is the current post in the loop"

The link was just to provide some background information on what are the possiblities.

The Lessons view you would create like a normal post view but adding the Videos view to it as well.

Thanks,
Shane

#593639

hey,
again, i'm not explaining myself right.

let me try from scratch:

we have a course. a course has many lessons in it.
each lesson has many videos in it.

we want to pinpoint 1 specific video within a specific lesson within a specific course.

but i went along with your suggestions and here's what happened:

i created a view for displaying all videos. it's showing the video's custom field, "video-embed".
i applied a query filter for this view - "Parent is the current post in the loop", so it will show only the videos within a chosen lesson.

next i created a view of lessons. i've nested the view "videos view" in it.

but now what? i have no search form, and when i place the 2nd "lessons view" in the course content, all i get is a list of videos.

i want that when the user enters the course, he will see a list of all lessons belonging to the course, and inside this list he will see a list of all videos within a lesson. i know how to make this happen, the only thing is i can't narrow the search to only 1 video because i can't create a search within a search:

"Thing is, I can't create a search form to include 2 consecutive filters of "lesson title" and then "video title", because they are different post types.

I also tried to create one search by "lesson title", and then, within the results view, create a new search by "video title" - but failed, since i want both to "show only available inputs" and this creates a conflict and makes the parent "lesson title" search just disappear."

thanks!
ido

#593655

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ido,

Would you mind providing me with admin access so I can assist and work alongside you with coming to a solution?

The private fields will be enabled for your next response.

Thanks,
Shane

#594094

hey,
let's leave it, i found a workaround: i'm just filtering by lesson name, and inside the lesson i'm displaying videos with pagination.
thanks!
ido