WordPress: Conditional tag to check a specific menu

wordpress-logo-notext-rgb
Following conditional tag usually use in this filter function, wp_nav_menu_items

if( $args->theme_location == 'primary' )

 

if( $args->theme_location == 'secondary' )

 

if( $args->theme_location == 'primary' )

For an example, I want to add search box to Primary Menu in WPZOOM theme name Videozoom. Conditional tag above make sure the search only show in a specif menu (Primary)
1. Open functions.php
2. Add following code to functions

add_filter('wp_nav_menu_items','search_box_function', 10, 2);
function search_box_function( $nav, $args ) {
if( $args->theme_location == 'primary' )
return $nav."<li class='menu-header-search'><form role='search' action='".get_bloginfo('url')."' id='searchform' method='get'><input id="s" type="text" name="s" placeholder="Search" /><input id="searchsubmit" type="submit" value="Search" />";

return $nav;
}

WordPress Conditional Tag for Login Page

wordpress-logo-notext-rgb
WordPress have conditional tags. The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches

Following conditional tag is specific to Login Page, that is currently not available on WordPress Codex

if ( in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) ) {
//Conditional statement here
}