Create search form in menu as in Twenty Fourteen theme

.animate() is the jQuery function you’re going to want to have a look at. Very handy. Here’s a working example for your particular question: http://jsfiddle.net/B8Yv9/ And a complete html workup: <!doctype html> <html> <head> <meta charset=”utf-8″> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”></script> <style> .search { width:300px; } .input-group { position:relative; float:right; } #btn-search { cursor:pointer; position:absolute; padding:3px 8px; … Read more

JSON file export of nav menu

Found a solution, modified it to suit my needs, Menu Item class: class Menu_Item{ private $object; private $object_id; private $link_name; private $link_value; public function __construct($object, $object_id, $linkname, $linkvalue){ $this->object_id = $object_id; $this->object = $object; $this->link_name = $linkname; $this->link_value = $linkvalue; } public function get_link_name(){ return $this->link_name; } public function get_object_id(){ return $this->object_id; } public function … Read more

How to construct a custom html for submenus

Okays.. i’ve solved this in my own way. i have added the following function in functions.php file class ik_walker extends Walker_Nav_Menu{ //start of the sub menu wrap function start_lvl(&$output, $depth) { $output .= ‘<div class=”dropdownContain”> <div class=”dropOut”> <div class=”triangle”></div> <ul>’; } //end of the sub menu wrap function end_lvl(&$output, $depth) { $output .= ‘ </ul> … Read more

How to add wechat (weixin) link to navigation menu?

Filter kses_allowed_protocols (wp-includes/functions.php wp_allowed_protocols) to add your protocol: add_filter( ‘kses_allowed_protocols’, function( $protocols ) { $protocols[] = ‘weixin’; return $protocols; }); The default values are ‘http’, ‘https’, ‘ftp’, ‘ftps’, ‘mailto’, ‘news’, ‘irc’, ‘gopher’, ‘nntp’, ‘feed’, ‘telnet’, ‘mms’, ‘rtsp’, ‘svn’, ‘tel’, ‘fax’, and ‘xmpp’.

Altering html structure and creating custom menus

Given the amount of customization you’re looking to make, your best bet may be to integrate a custom Walker function. From the Codex: For deeper conditional classes, you’ll need to use a custom walker function (created in the ‘walker’ => new Your_Walker_Function argument). The easiest way to build a new walker function is to copy … Read more

how to change the output of wp_nav_menu using css classes

Here are three approaches: I – Plugin for the a-class- prefix: We can target the <a> tags with the a-class-… class prefix. So in your case the way to get: <li id=”menu-item-290″ class=”blue yellow …”> <a class=”red pink” href=”http://localhost/en-wptuts/”>home</a> </li> is to use the following menu classes: blue yellow a-class-red a-class-pink We support this with … Read more

Custom walker with hashes instead of links (one-page layout)

Well, after some more intense research I finally found a viable solution that is clean and simple and works flawless so far. Just put this into your functions.php to create a custom walker which turns classic permalinks into hashes (e.g. page.com/mypage to page.com/#mypage): /* Custom nav walker */ class Single_Page_Walker extends Walker_Nav_Menu{ function start_el(&$output, $item, … Read more

Add itemprop Schema.org Markup to li Elements in wp_nav_menu

To add attributes to the menu’s li elements, you’d have to write your own custom walker that extends the default Walker_Nav_Menu class (which is itself an extension of the Walker class). For more info: https://codex.wordpress.org/Class_Reference/Walker But as itemprop=”url” should normally be added to anchor elements, you could use the nav_menu_link_attributes filter. For example, as per … Read more