Function not working when Live
-
Trying to add a search form to my primary nav on wordpress site: christinatbhotz.com. It works beautifully on MAMP but nothing shows up when live.
This is what it looks like locally.
This is what it looks like when I take out the primary menu logic when it’s live.
No search boxes show up at all when the primary logic is still in place.
Functions code is below.
// Search in Nav add_filter('wp_nav_menu_items', 'add_search_menu', 10, 2); function add_search_menu($items, $args) { if ( 'primary' != $args->theme_location ) return $items; ob_start(); get_search_form(); $searchform = ob_get_contents(); ob_end_clean(); $items .= '<class="site-nav">' . $searchform . ''; return $items; } // Add to your init function add_filter('get_search_form', 'my_search_form'); function my_search_form($text) { $text = str_replace('value="Search"', 'value=""', $text); return $text; }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Function not working when Live’ is closed to new replies.