Print
Category: Tutorials
Hits: 7862
27Mar2023

Create a hidden menu item for search results

Information
First published August 24, 2011
7862 hits -

You want to see search results in a specific page, have modules associated to that page but do not want to have a specific menu item for it. Why? Because you already have a search box in your template and therefore do not need a menu item for it. And modules need to be associated to a specific page unless they are supposed to show on all of them.

An easy solution is to create such a menu item but making it invisible to the user.

Step 1 - Create a menu item

Go to menus, then click on add a new menu item.

Step 2 - Enter the menu item details

Select the menu item type 'List search results' and give the menu item a name.

Menu item details

Step 3 - Enter menu item options

Give a class name to apply to the menu item.

Menu item Options

Step 4 - Add styling code to the default template

Now, in the default template css file, add the following code:

/* search results menu */
.searchresult {
     display: none;
}

From now on, when a user starts a search from your template search input box, the results will show into a specific page and give you control over which modules should also show on that page.