Add Google Custom Search to WordPress Blogs - Excluding the Google Custom Search Result Page in WordPress Navigation
(Page 4 of 4 )
Depending on how your blog has been configured or set up, you can exclude the Google Custom Search Result page in three different ways.
If you are using a widget to display pages (e.g in your sidebar navigation), you can customize that widget to exclude the WordPress search result page powered by Google Custom Search. To do this, go to Appearance -> Widgets, click Pages and enter the Page ID of the search result page to exclude.
The page ID can be found in the URL. If you go to Pages -> Edit and click the search result page, the URL can look similar to this (again, using my own site as an example):
The page ID in the example above is 78. How to exclude it using Widgets is shown in the screen shot below:
That's the first approach. You can also exclude the search result pages you have created by editing the wp_list_pages function in all of the affected WordPress template files (Go to Appearance -> Editor). These are single.php, index.php, page.php, and possibly header.php (not all templates include this).
Edit the files, find the wp_list_pages function in the function and then add the ID in the exclude parameter, for example:
<?php wp_list_pages('title_li=&depth=1&exclude=78'); ?>
Your third option is to use a WordPress plug-in to exclude a specific page in WordPress, but due to security risks and incompatibility issues, this is not recommended and is considered a last resort.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |