Tagged: customization, enfold
-
AuthorPosts
-
September 20, 2013 at 7:01 am #163920
Hi
My website is http://career.guru99.com/
now i have successfully add google custom search but look and feel of google custom search is not good as per as my requirement.
here you can check what i actually want – http://screencast.com/t/rMZcLLlByV
But in actual my google custom search look like this – http://screencast.com/t/aiski0jpI
and i want google custom search here – http://screencast.com/t/fKSCOojxYc
So please help me to do this
September 20, 2013 at 1:51 pm #164052Hello kriru!
Can you please add the google search? I don’t see it on the website.
Best regards,
IsmaelSeptember 20, 2013 at 2:09 pm #164067Ismael Please check – http://career.guru99.com/
September 21, 2013 at 9:32 am #164370Hello!
You can use the wp_nav_menu_items filter to add list items to the menu. I.e. Kriesi uses this filter to add the search icon to the main menu. The code looks like
add_filter( 'wp_nav_menu_items', 'append_google_search_nav', 10, 2 ); function append_google_search_nav( $items, $args ) { if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu")) { global $avia_config; ob_start(); get_search_form(); $form = htmlspecialchars(ob_get_clean()) ; $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown"><a href="?s=" data-avia-search-tooltip="'.$form.'">'.$avia_config['font_icons']['search'].'</a></li>'; } return $items; }
– instead of
global $avia_config; ob_start(); get_search_form(); $form = htmlspecialchars(ob_get_clean()) ; $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown"><a href="?s=" data-avia-search-tooltip="'.$form.'">'.$avia_config['font_icons']['search'].'</a></li>';
insert your search form code – i.e.
$items .= '<li id="menu-item-google-search">YOUR SEARCH FORM CODE</li>';
and add the code to the bottom of functions.php.
Cheers!
PeterSeptember 23, 2013 at 11:44 am #165104I got this error while implement this. will you please tell me in detail
September 23, 2013 at 12:57 pm #165128call_user_func_array() expects parameter 1 to be a valid callback, function ‘append_google_search_nav’ not found or invalid function name in E:\Guru99\xampp\htdocs\career99\wp-includes\plugin.php on line 173
September 25, 2013 at 12:52 am #165884Hi!
You need to add in the function above and customize it for your specific google search code. So add this to your functions.php:
add_filter( 'wp_nav_menu_items', 'append_google_search_nav', 10, 2 ); function append_google_search_nav( $items, $args ) { if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu")) { global $avia_config; ob_start(); get_search_form(); $form = htmlspecialchars(ob_get_clean()) ; $items .= '<li id="menu-item-google-search">YOUR SEARCH FORM CODE</li>'; } return $items; }
Where it says “YOUR SEARCH FORM CODE” you need to add the code for your search form.
Best regards,
Devin -
AuthorPosts
- The topic ‘How to customize google custom search?’ is closed to new replies.