WordPress:添加自定义内容到导航菜单

tencent promotion
原创作者: Fengjiajun

WordPress:添加自定义内容到导航菜单

function add_custom_menu_item ( $items, $args ) {
    if ( $args->theme_location == 'primary') {
        $items .= '<li>'.do_shortcode('[woocommerce_currency_switcher_drop_down_box]').'</li>';
    }
    return $items;
}
add_filter( 'wp_nav_menu_items', 'add_custom_menu_item', 10, 2 );

效果图如下: