// =========================================================================
// ADD FLAG ICON TO THE WORDPRESS NAV MENU
// =========================================================================
function add_custom_menu_item ($items, $args) {
ob_start();
$items .= '<li class="menu-item flag">';
$items .= '<a href="#" target="_blank"><img class="flag" src="'.THEME.'/assets/images/flags/flag-hu.svg" alt=""/></a>';
$items .= '</li>';
return $items;
}
add_filter( 'wp_nav_menu_items', 'add_custom_menu_item', 10, 2 );
flag-hu.svg
<svg version="1.1" id="flag-hu" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 34" style="enable-background:new 0 0 50 34;" xml:space="preserve">
<style type="text/css">
.st0{fill:#CE2939;}
.st1{fill:#FFFFFF;}
.st2{fill:#477050;}
</style>
<rect id="black_stripe" y="0" class="st0" width="50" height="34"/>
<rect id="red_stripe" y="11.3" class="st1" width="50" height="22.7"/>
<rect id="gold_stripe" y="22.7" class="st2" width="50" height="11.3"/>
</svg>
flag-de.svg
<svg version="1.1" id="flag-de" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 34" style="enable-background:new 0 0 50 34;" xml:space="preserve">
<style type="text/css">
.st0{fill:#DD0000;}
.st1{fill:#FFCE00;}
</style>
<rect id="black_stripe" y="0" width="50" height="34"/>
<rect id="red_stripe" y="11.4" class="st0" width="50" height="22.6"/>
<rect id="gold_stripe" y="22.6" class="st1" width="50" height="11.4"/>
</svg>
Leave a Reply