• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
Web Safari at Giraffeweb

Web Safari at Giraffeweb

Giraffe Web Development & Design

864-232-6363



Greenville SC SEO and Web Design Company
  • Home
  • About

Genesis Search Pop Up

November 4, 2017 by webmaster

Here’s how to make the Genesis child theme search into a pop up instead of embedding on your page.  Backup your child theme functions.php file – I usually just open Appearance->Editor->functions.php then copy and paste the entire functions.php file into Notepad, or I ftp into the site and download it.

  1. Create an icon, or add text for your search action.  The search icon below is just a graphic in a header widget.
  2. Enable WordPress to allow shortcodes in widgets by adding the below to your child theme’s function.php:
    // Enable shortcodes in widgets
    add_filter( 'widget_text', 'shortcode_unautop' );
    add_filter('widget_text', 'do_shortcode');
    add_action( 'init', 'gw_register_shortcode' );
    
    
  3. Create the Genesis Search shortcode
    function gw_register_shortcode() {
     add_shortcode( '404-search', 'gw_search_shortcode' );
    }
    
    /**
    * Search Shortcode Excerpt
    */
    function gw_search_shortcode() {
     return '<div class="404-search">' . get_search_form( false ) . '</div>';
    }
  4. Edit your child theme CSS and add:
    .search-form {
    	position: relative;
    }
    
    .search-form > input {
        padding-left: 50px;
        padding-top: 0px;
        padding-bottom: 0px;
    }
    
    .search-form input[type="submit"] {
        background: none !important;
        position: absolute;
       }
    
  5. To enable the popup function, install the Easy FancyBox plugin which is a lightweight plugin that includes all the jquery you need. At some point, I hope to update this post with the jquery to add directly to your site but this should work fine for now. Once installed, add the following code surrounding your search icon shown in #1 above:
    <a class="fancybox" href="#search-pop"><img src="url to image icon" /></a>
    
    <div class="fancybox-hidden" style="display: none;">
    
    <div id="search-pop">[404-search]</div>
    
    </div>

…When you click on the search icon, here is what it looks like:

Note – if you do not have dashicons enabled, you will need to add the following to your functions.php:

//* Enqueue Dashicons
add_action( 'wp_enqueue_scripts', 'gw_enqueue_dashicons' );
function gw_enqueue_dashicons() { 
 wp_enqueue_style( 'dashicons' ); 
}
add_filter( 'genesis_search_button_text', 'gw_search_button_dashicon' );
function gw_search_button_dashicon( $text ) { 
return esc_attr( '&#xf179;' ); 
}

and use the below for you CSS instead:

.search-form {
	position: relative;
}

.search-form > input {
    padding-left: 50px;
    padding-top: 0px;
    padding-bottom: 0px;
}

.search-form input[type="submit"] {
    background: none !important;
    border: none;
    clip: inherit;
    color: #4a545a;
    display: inline-block;
    font: 28px/1 'dashicons';
    height: 38px;
    padding: 0 10px 0px 12px;
    position: absolute;
    left: 2px;
    top: -10px;
    vertical-align: top;
    width: 38px;
}

Filed Under: Coding, Custom WordPress, Genesis

Primary Sidebar

Links

  • Giraffe Web Development
  • Google Workspace Signup
  • Privacy Policy
  • SEO
  • Shop at Amazon!
  • Shop on Etsy
Giraffe Web
Recommends Liquidweb
Liquidweb

Categories

  • ADA Compliance for Websites
  • Business Related
    • Conferences
    • inspirational
    • motivational
    • Scams
  • Coding
    • Browsers
    • Javascript
    • Sound on Websites
    • Valid Code
  • Custom WordPress
  • Domain Names
  • Email Deliverability
    • DKIM
    • DMARC
  • Funnel
  • Genesis
  • Google Sites
  • Google Workspace
  • How to Do Video Transcription
  • Mobile Web App
  • News
    • SEO Rockstars
  • Recent 'Sightings' (Website Portfolio)
    • e-commerce
  • References
  • SEO
  • Unified Messaging

Copyright © 2025 · All Rights Reserved · The Official Blog for Giraffe Web