Title: Modify search widget
Last modified: December 6, 2019

---

# Modify search widget

 *  Resolved [P51Admin](https://wordpress.org/support/users/p51admin/)
 * (@p51admin)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/modify-search-widget-2/)
 * Hello There;
 * Thanks for your previous response.
 * I have progressed to the point where I am almost ready to move this site to production.
 * I have just two more concerns right now.
 * 1.- How would I get rid of the RSS links in the header and footer?
 * 2.- How would I change the appearance of the search widget in the footer to NOT
   display “Search …” over the entry field or change the text on the search button?
 * thanks again …
 * P51 Admin

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Theme Author [htmlpie](https://wordpress.org/support/users/htmlpie/)
 * (@htmlpie)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/modify-search-widget-2/#post-12211384)
 * Hi there,
 * You’re welcome.
 * That’s awesome!
 * 1. Appearance -> Customize -> Contact Information -> Feed.
 * 2. If you are using a Child theme, add this to the functions.php of that, otherwise
   use a plugin (such as Code Snippets) to add it to your site.
 *     ```
       if ( ! function_exists( 'CHILD_THEME_NAME_search_form' ) ) {
       	function CHILD_THEME_NAME_search_form( $form ) {
       		if ( $form ) {
       			$form = preg_replace( '/(<[^>]+) placeholder=".*?"/i', '$1', $form );
       			$form = preg_replace( "/(?<=value=(\"|'))[^\"']+(?=(\"|'))/", esc_html__( 'Go', 'CHILD-THEME' ), $form );
       			return $form;
       		}
       	}
       }
       ```
   
 * Then add this either to the footer.php of the Child theme, or through a plugin
   to the footer.
 *     ```
       if ( function_exists( 'CHILD_THEME_NAME_search_form' ) ) {
       	add_filter( 'get_search_form', 'CHILD_THEME_NAME_search_form', 100 );
       }
       ```
   
 * Hope it helps!
    -  This reply was modified 6 years, 10 months ago by [htmlpie](https://wordpress.org/support/users/htmlpie/).
    -  This reply was modified 6 years, 10 months ago by [htmlpie](https://wordpress.org/support/users/htmlpie/).
    -  This reply was modified 6 years, 10 months ago by [htmlpie](https://wordpress.org/support/users/htmlpie/).
 *  Thread Starter [P51Admin](https://wordpress.org/support/users/p51admin/)
 * (@p51admin)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/modify-search-widget-2/#post-12215529)
 * Thank you very much for your very quick response!
 * I found the RSS feed setting and will certainly use that … thanks
 * I have to admit to you that I although I am an individual with 30+ years technical
   experience I am NOT a developer (coder).
 * Please dumb down your search button solution for me …
 * I am not using a child theme (yours is the only theme on the system)
 * Where do I find the files that you are referring to and where in the file should
   I insert the code?
 * I do have the site running on a VM in my offices, and uploaded to the “staging”
   area on my ISP. So depending on where the file resides I may or maynot have write
   access to the file. (I only have write access to the wp-content structure)
 * thanks again for all your time and assistance in the this matter.
 * P51 Admin
 *  Theme Author [htmlpie](https://wordpress.org/support/users/htmlpie/)
 * (@htmlpie)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/modify-search-widget-2/#post-12217182)
 * That’s alright, please follow these steps:
 * 1. You just need a plugin to add the code to your site.
    Go to the plugins directory(
   or Plugins -> Add New, if it’s online right now) and search for “insert code”,
   you can find so many plugins there, I’ll pick this one because it’s popular: 
   [https://wordpress.org/plugins/insert-php-code-snippet/](https://wordpress.org/plugins/insert-php-code-snippet/)
 * 2. Install and activate the plugin and go to “XYZ PHP Code” (in the left sidebar)
   and click the “Add New PHP Code Snippet” button.
 * 3. Put the code there:
    (you should replace SITE_NAME in the code with anything
   that makes the function name unique like your site or domain name, or maybe ‘
   my_custom_function_for’ or something like that)
 *     ```
       <?php
       if ( ! function_exists( 'SITE_NAME_search_form' ) ) {
       	function SITE_NAME_search_form( $form ) {
       		if ( $form ) {
       			$form = preg_replace( '/(<[^>]+) placeholder=".*?"/i', '$1', $form );
       			$form = preg_replace( "/(?<=value=(\"|'))[^\"']+(?=(\"|'))/", esc_attr__( 'Go', 'pen' ), $form );
       			return $form;
       		}
       	}
       	add_filter( 'get_search_form', 'SITE_NAME_search_form', 100 );
       }
       ?>
       ```
   
 * The Name can be “Search Widget Tweaks” or something like that.
 * 4. Click the “Create” button, you’ll be brought back to the previous page, now
   there is a “Shortcode” for that snippet.
    Copy that Shortcode and go to “Appearance”-
   > Widgets, find a “Text” widget and add one to same Widget Area as your Search
   widget. Make sure the Text widget is placed before or at the top of the Search
   widget.
 * 5. Click the “Text” tab of the editor in that Text widget and paste that Shortcode
   there. Now click the Save button and you are done. 🙂
 * Caution: Use such plugins very carefully, putting bad code or anything that is
   not thoroughly tested may lead to an absolute mess, just saying.
 * Hope it helps!
 *  Thread Starter [P51Admin](https://wordpress.org/support/users/p51admin/)
 * (@p51admin)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/modify-search-widget-2/#post-12217821)
 * Thanks again for your quick responses …
 * I will mark this as resolved, but it will be a couple of days before I can give
   this information a try.
 * I am sure thanks to your expertise I will get this done.
 * P51 Admin

Viewing 4 replies - 1 through 4 (of 4 total)

 The topic ‘Modify search widget’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/pen/1.4.8/screenshot.png)
 * Pen
 * [Support Threads](https://wordpress.org/support/theme/pen/)
 * [Active Topics](https://wordpress.org/support/theme/pen/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/pen/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/pen/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [P51Admin](https://wordpress.org/support/users/p51admin/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/modify-search-widget-2/#post-12217821)
 * Status: resolved