By default the Winning Agent Pro theme shows the Search Bar widget on every page. However, there may be some pages that you don’t need or want it to show. This tutorial will show you two methods to remove search bar widget on select pages in Winning Agent, so you can choose the one that’s easiest for you. These will work for you whether you use IDX Broker or AgentPress Listings in your search bar.
Method 1 – Edit functions.php and Add a Body Class
Note: Before editing your functions.php, backup your WordPress, download a copy of functions.php, and be sure you have FTP or CPanel access to your website.
For this method, you will make a one-time edit to functions.php, and then, whenever you want to hide the search bar on a particualar page, you would add a body class to that page. So here’s how.
Step 1. Edit functions.php
In your functions.php, at line 157, find the following section, comment it out, as shown, and add the new code section just below it.
Upload your new functions.php to your Winning Agent theme folder using FTP.
Step 2. Add a Body Class to Select Pages
In WordPress, edit one of the pages that you want to hide the search bar.
- Look below the editor.
- You’ll find a section section labeled “Layout Settings”. (If you don’t see this section, you can click on the “Screen Options” tab in the upper right hand corner, and check it.)
- In the field labeled “Custom Body Class” add:
no-search-bar - Click the blue Update button to save the page.
You can add the “no-search-bar” body class to any pages you want to remove or hide the search bar.
Method 2 – Use a Widget Visibility Plugin
You can also use a widget visibility plugin to remove the search bar on select pages. This tutorial shows you how to use the Widget Visibility module in Jetpack. If you don’t use Jetpack, Display Widgets or Restrict Widgets will also work.
- If you use Jetpack, you can activate the Widget Visibility module.
- Then go to Appearance > Widgets > Search Bar widget area.
- Open the widget you’re using (Text widget or AgentPress – Listing Search), and click the gray Visibility button at the bottom next to the blue Save button.
- Then change “Show” to “Hide”.
- From the drop down, choose “Page” is > and select the pages you want to hide.
- Click the blue Save button on the widget.
We’re always here to help you with your Winning Agent theme, if you need it. Just complete a support request.
Leave a Reply