Skip Navigation

[Resolved] Search form not showing included results

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

Problem: Search form not showing included results - filter view by custom field and exclude the results with specific values

Solution: You can find the proposed solution in this case with the following reply: => https://toolset.com/forums/topic/search-form-not-showing-included-results/#post-1971725

Relevant Documentation:

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.

This topic contains 15 replies, has 2 voices.

Last updated by maiS 1 month, 1 week ago.

Assigned support staff: Minesh.

Author
Posts
#1966025

Hi there,
I have a search form on my front page (link: hidden link)

This search form is supposed to include Camps in our search results and i checked that the Camps are marked as included in the search. But no camps show up in the search results. I even tried searching for a specific Camp name. Can you help?

#1966711

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I see on the backend:
=> hidden link

You added the view but when you mouse hover it will ask you either you want to Edit original view or want to add the view as a Copy.

Please check the following screenshot: hidden link

if you are using the view you added to the above page on other places as well, can you please try to use the option "Edit Copy" and update your page and check if that help you to resolve your issue.

#1966795

Hi there,

It does not solve anything as the Camps are also marked to be included in the copy version. So even though i uncheck it and then check it again, the camps still doesn't show up in the search results.

#1966825

Minesh
Supporter

Languages: English (English )

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

I need bit more information.

Do you want to display search form and search result on same page or on different page.

And I see there is a filter added to the view to exclude the post with value equal to 0.

Can you please clarify you views purpose and I am happy to check this further.

#1967221

hi there,

So this search form is basically a "search for everything on the entire page" form. When you select other pages the search forms are specificly made for these pages. But this one needs to include both pages, camps and the other things that are checked in the settings.

The search form should be on the frontpage and the search results should appear on this site: hidden link

The excluding rule is to make sure that pages like Checkout, Cart etc. - pages that should be hidden from the search form. So the results should only include specific pages.

Now my problem is, that the camps are not showing up in the search results even though i marked them in the settings under which elements should be included in the search.

#1967993

Minesh
Supporter

Languages: English (English )

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

I can see the camp results are displaying when I search with the "camp" keyword:
=> hidden link

#1969099

Yes but not all camps show up - if i search for camp here are some examples of camps missing in the results:

VB Begynder Camp
Vinterferie Camp
VB Vinter Camp
Værløse Efterårs Camp
Solrød Camp 2020

#1970691

Minesh
Supporter

Languages: English (English )

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

The thing is that you are filtering your view by "Query Filter" Exclude equal to 0.

I just went to edit the one of the post that was not get displayed:
- VB Begynder Camp
- Vinterferie Camp

And just clicked the "update" button and then I can see that above posts get displayed with view result.

Basically - by default until you save/update your post, the default value for "Exclude" field will not get set.

I suggest you should update your remaining posts and it will start to get displayed with your results.

#1971375

hi there,

Is there a way to make the camp posts visible by default? Because when people start creating camps they won't have acces to the backend - they do it all from the frontend.

#1971725

Minesh
Supporter

Languages: English (English )

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

You need to make sure that when camps are created from frontend - you must add default value for your exclude custom field.

To set a default value for your field, you should edit your Toolset Form and add the following hidden field:

[cred_generic_field field='wpcf-exclude' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"default":"0"
}
[/cred_generic_field]

The above field will set the default value 0 to the Exclude custom field when you submit the form.

Please edit your form and add above field just before the submit button and then try to create a new post from frontend and check if that post is visible by default when you search. It should.

#1972919
Skærmbillede 2021-03-02 kl. 23.03.20.png

Hi there,

I followed your guide, but now i have this - see screenshot. What did i do wrong?

#1973117

Minesh
Supporter

Languages: English (English )

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

Please check your form now:
- hidden link

I switched to Expert Mode and added the Generic field shortcode just before the submit button. It should work now. Can you please check.

#1975469

Thank you so much, i will check it

#1975477

Minesh
Supporter

Languages: English (English )

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

Ok - once you find it working, you are welcome to mark resolve this ticket 🙂

#1975479

Seems like it is working! Thanks!