patric-boehner
7/8/2016 - 8:08 AM

Add logo to beginning of menu

Add logo to beginning of menu

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

// Notes:
// Add logo via css background imgae.

// Refrance:
//* https://developer.wordpress.org/reference/functions/wp_nav_menu/

//* Filter menu "primary" to add logo structure
add_filter( 'wp_nav_menu', 'pb_menu_logo', 10, 2 );
function pb_menu_logo( $menu, $args ) {

   $args = (array)$args;
	if ( 'primary' !== $args['theme_location']  )
	return $menu;
	$logo = '<div class="menu-logo"></div>';
	return $logo . $menu;

}