Skip Navigation

[Resolved] Search box

This support ticket is created 3 years, 10 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
- 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/Karachi (GMT+05:00)

This topic contains 24 replies, has 2 voices.

Last updated by Waqar 3 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#1672417

Hi there,
Does Toolbox not have a search box element? I need a search box on my frontend but I can't find an element for it?

#1672991

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

If your goal is just to insert the WordPress default search form, you can use the "Search" block.
( example screenshot: hidden link )

However, to create a customized search form with additional search filters, you'll need to create a post view as explained in this lesson:
https://toolset.com/course-lesson/creating-a-custom-search/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1674389

Hi Waqar,

The WordPress default search bar is just not very interesting to look at, but I just want a search bar that can search amongst everything on the entire page (post, pages, products and so on). Do you know if I can style the default search bar or if I can use the Toolbox custom search to do this?

I watched the video but it seems very customized and I need that for some other pages but on the frontpage it should just be possible to search for everything. Is there a setting I can choose to make this happen?

#1674409

Okay sorry, I just realized with the Toolbox that I choose what to search amongst. But about the results. Is it possible to make them show up on a different page and not right below the search box?

#1674447

And also, when I style the results I am choosing "dynamic headings" for example, but then I have to chose between where I want to take the data from and I can only chose 1 option. How do I set it to just pick the title from where ever the page, post, product is?

New threads created by Waqar and linked to this one are listed below:

https://toolset.com/forums/topic/split-how-to-select-the-dynamic-source-for-the-headings/

#1674453

Also, I don't want any results to show up until the user has searched for something. How do I hide the loop until the search has been made?

New threads created by Waqar and linked to this one are listed below:

https://toolset.com/forums/topic/split-how-to-hide-results-until-the-search-has-been-made/

#1674471

When I add the pagination and I set the setting to be centered on the page it doesn't work. How can I fix that?

New threads created by Waqar and linked to this one are listed below:

https://toolset.com/forums/topic/split-search-box/

#1676421

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thanks for writing back and sorry about the delay in getting back on this.

Since your recent questions cover different topics, I'll be replying to them in their separate tickets. Multiple topics in a single thread make the follow-up difficult for everyone.

> I just realized with the Toolbox that I choose what to search amongst. But about the results. Is it possible to make them show up on a different page and not right below the search box?

- Yes, it is possible to show a view's search form on one page, and the search results on another.

To achieve this, you can follow these steps:

1. Please create a new page to create a post view and name it something like "Search View Page". The role of this page will only be to create and hold the post view for later edits, but it will not be used for actually showing the search form or the results.

On this page, insert a "View" block and create a view as needed, including the search form and the search results.
( ref: https://toolset.com/glossary/view/ )

2. Next, please create a new page and name it something like "Search Results Page". The role of this page will be to show the search results.

On this page, insert a "View" block and from the existing views, select the one created in step 1.

From the view block's settings, choose "Only the search results", under the "Custom Search Settings".
( screenshot: hidden link )

3. The last step would be to insert the search form.

In your desired page, for example, "Home" insert a "View" block and select the existing view the same as in the last step.

The only difference would be that in this view block's "Custom Search Settings", you'll select "Only the search form" and also select the page on which you'd like to show the results, which was created in step 2.
( screenshot: hidden link )

As a result, when a visitor will use the search form inserted on the home page, the results will be shown on a separate page.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1679573

Hi Waqar,

The function works perfectly, but the design I made in the original view for the results loop is not being copied. I set it to 3 columns and now it only shows 1 column. The rest of the settings are being copied as they should.

#1682681

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting, while I performed some tests on my website.

I was able to reproduce this issue, where the grid loop styles are not properly carried over when a view is inserted on any page, other than where it was created.

I've passed on this report to the concerned team and will keep you updated with the progress through this ticket.

For now, you can use the following workaround:

1. On the page where you'd like to show the search results, you can remove the block for the old view and add a new one to re-create the view with the search and the results.

As a result, on this search results page, you'll have the search form and the results, in the correct grid layout.

2. On the homepage, where you just need to show the search form, you can remove the existing view block and insert a new view block which shows only the search form from the newly created view from step 1, and select the search results page, to show the results on.

This should do the trick.

#1685105

Hi Waqar,

I will try that!

When I already chose what to search amongst, how to I add / remove what to search for? For example if I don't want pages amongst the results, but I chose them during creating the form, how do I remove it again?

Also, is it possible to exclude only SOME pages?

#1685111

And also, right now the search box is full width - how to I reduce the size to like.. 200 pixels width?

#1688469

Hi Waqar, can I still use this ticket or should I open af new one regarding my 2 latest messages?

#1688679

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

I'd have to remind and request again, to keep one ticket limited to only one question/topic. Reaching to the desired information and follow-up becomes really challenging if various things are discussed in one thread.

> When I already chose what to search amongst, how to I add / remove what to search for? For example if I don't want pages amongst the results, but I chose them during creating the form, how do I remove it again?

- Please open your view block's settings and under the "Content Selection", you can select which post types should be included.
( screenshot: hidden link )

> Also, is it possible to exclude only SOME pages?

- To achieve this, you can register a new "select" type custom field "Exclude from the search" with all the post types which need to be covered in the search results.

That field will have two options: the default option "No" (value: 0) and "Yes" (value: 1). For all the posts, "No" (0) will be saved by default when they'll be created or saved. But for posts/pages which you'd like to be excluded, you should the value to "Yes" (1).

In your search view, you can include a "Query Filter" ( screenshot: hidden link ) for this custom field to bring only those posts where the value of this field is equal to "0".
( ref: https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/ )

> And also, right now the search box is full width - how to I reduce the size to like.. 200 pixels width?

- To reduce the width of the search field to a maximum value like 200px, you can include some custom CSS code.

For example:


.wpv-filter-form .wpv-custom-search-filter input {
    width: 80%;
    max-width: 200px;
    margin: 0px auto;
}

#1705067

Hi Waqar
- To achieve this, you can register a new "select" type custom field "Exclude from the search" with all the post types which need to be covered in the search results.

That field will have two options: the default option "No" (value: 0) and "Yes" (value: 1). For all the posts, "No" (0) will be saved by default when they'll be created or saved. But for posts/pages which you'd like to be excluded, you should the value to "Yes" (1).

- Sorry but where do I create this custom field? Under Toolset --> Custom Fields ---> Post type?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.