Skip Navigation

[Resolved] Exclude Specific Pages From Search

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to filter taxonomy filter dropdown options and display specific terms

Solution:
There is no way to filter the term options added to taxonomy filter select box using views but a workaround would be:
You need to use WordPress standard hook "pre_get_terms" in order to filter the taxonomy query.

You can find the proposed solution, in this case with the following reply:
https://toolset.com/forums/topic/exclude-specific-pages-from-search/page/2/#post-1611953

Relevant Documentation:

This support ticket is created 4 years, 7 months 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 17 replies, has 2 voices.

Last updated by Pete 4 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1609499
Main Destination Pages Only.jpg

Hi there,

We have a couple of sites using Toolset for holiday properties just in specific areas, works great.

We now need to create one 'master' site, this has all the main areas and also it's sub areas....this we can't work out something.

In our main search bar for example (this on all our main landing pages)
hidden link

This sends results to a Search Results Page.

However we only wish this to have the main destination pages (in red) included in the drop down....not all the sub pages under.

How do we exclude pages? I see no filter option in the view and have tried various things however because pages can't have categories or be defined in any way, I can see no way of including and excluding what we need 'for pages' in search options for Toolset.

Many thanks as always.

#1610245

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean that you want to display the search form with the only pages which you marked with red box and those only pages should display the search box and on other pages it should not display search box?

#1610251

Hi Minesh,

Hope you are well and safe.

Yes, for certain Views where we use the search bar shown in the link, we only wish to have the 'main' pages show up here....we have so many sub pages the drop down will be too, too long.

Thank you.

#1610379

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I do wonder how you build the page because the thing is that at whatever place/page/post/content template you will add the view it will be displayed.

Do you mean you want to have a different layout for different pages?

#1610381
Areas.png

Minesh,

Please see attachment.

We have all these areas, we need these for Views to display on specif pages however for the main search bars found on this page:
hidden link

This sends results to the search results page.

We clearly cannot have a drop down with this many areas in it.

I'm after a way of selecting which pages I have in this one drops down (view)

#1610479

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

There is no way to add the post links to the dropdowns.

As I understand, you want to display the direct link of those are posts but maybe you misunderstood how view works.

It looks like with your setup, the area is setup as a custom field or taxonomy. The view will display the dropdown options for only those area for which the results are available. And when you search the view obviously it will redirect you on the search result page rather on those specific area pages. This is expected.

If you want to display link of those area posts, you need to create a view that display those are links.

#1610539

Ok, so can I make the drop down display specific category page links?

If so how? Did not know I could do that?

#1610545

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can not make a dropdown but as I said you can create a view that displays the links. Maybe you can create a view that display those post links and display the view as sidebar using view's widget?

#1610547

Minesh, they aren't post links....the drop down shows the area category...this issue all along is we have so many and the drop down will be huge.

I can't think of any other way of having areas that we need for the rest of the site yet excude a HUGE LIST from a drop down.

They are not page links...they are categories.

#1610551

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I understand but as stated, even if those are the categories, there is no way to exclude specific terms from frontend taxonomy term filter. As there is no option to exclude terms.

#1610593

So do you have 'an' suggestion on what we can do alternatively?

We need about 8 main categories, these our (main destinations). Thees to appear in the main search bar drop down.

For other, smaller sub pages (sub destinations), we will totally separate views. These are not connected with the above.

If we remove all these from our list of categories, how can we create views for these smaller sub pages if there are not categories?

#1610597

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

what if you create a term field like "is Main page category?" using checkbox type field and checkmark the checkbox for the terms where you want.

And then later, you need to add the custom hook to filter your taxonomy query results. Can you setup the term custom field as I said above and setup the terms which you want to display on main page and send me access details and problem URL where you want to display those terms.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1610657
Filter.png
Portfolio.png

Hmmm ok trying to give this a try as I learn from doing 🙂

I have created a custom field called Sub Area, this appears for our property listings. (see portfolio)

However in a View, I can see no way of identifying the specific check box....in this example Windermere.

Am I on the right track with this?

Thank you.

#1610691

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

What I've said and what you have done is totally different thing. I've asked to create a custom TERM field not custom post field.

However - with the link you shared: hidden link
- I can see with the destination frontend dropdown filter, I can only see few terms. You still want to remove few terms from that destination dropdown? If yes, what are those which you want to remove.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1610701

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I say remove, I do not mean to remove actually.

Can you please answer my question here:
However - with the link you shared: hidden link
- I can see with the destination frontend dropdown filter, I can only see a few terms. You still want to remove/hide few terms from that destination dropdown? If yes, what are those which you want to remove/hide from the dropdown.