Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Disable a search field from a specific page › Reply To: Disable a search field from a specific page
Hi Benny,
If I understand correctly, you have 2 search instances:
– 1 is used to be displayed everywhere (via a shortcode or override etc..)
– 2 is only used on specific pages
You want to exclude the first one (1) from some of the pages, is that correct?
It should be possible by using a custom code, to detect which page ID is currently displayed, then disable the shortcode on those pages. A modification to the core code is also required, as the shortcode output is not filtered.
Step 1 – Change the core code
1. Open up the wp-content\plugins\ajax-search-pro\includes\classes\shortcodes\class-asp-search.php file on your server
2. Scroll to line 216, which should be this:
[php] return $out;[/php]
3. Change that line to this:
[php]return apply_filters(‘asp_shortcode_output’, $out, $id);[/php]
Step 2 – Custom code
Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Change variables $disabled_pages, $disable_home and $search_id according to your needs.