WPML language switcher not showing up in menu
huubl opened this issue · 3 comments
huubl commented
Hi,
I'm using WPML to make my website multilingual, but the language switcher is not showing with Navi. The switcher is present when using wp_get_nav_menu_items().
[...]
35:
ID: "wpml-ls-2-en"
attr_title: ""
classes: (8) ["menu-item", "wpml-ls-slot-2", "wpml-ls-item", "wpml-ls-item-en", "wpml-ls-current-language", "wpml-ls-menu-item", "wpml-ls-first-item", "wpml-ls-last-item"]
db_id: "wpml-ls-2-en"
description: null
menu_item_parent: 0
menu_order: 36
object: "wpml_ls_menu_item"
object_id: "wpml-ls-2-en"
post_parent: null
post_title: "<img class="wpml-ls-flag" src="http://localhost:3002/app/plugins/sitepress-multilingual-cms/res/flags/en.png" alt="English">"
post_type: "nav_menu_item"
target: null
title: "<img class="wpml-ls-flag" src="http://localhost:3002/app/plugins/sitepress-multilingual-cms/res/flags/en.png" alt="English">"
type: "wpml_ls_menu_item"
type_label: null
url: "http://localhost:3002"
xfn: null
_invalid: false
[...]
When changing:
Lines 81 to 83 in 5e1e3dd
To:
$menu = collect($menu)->filter(function ($item) {
return $item;
})->all();
Are there possible side effects of removing: instanceof \WP_Post ?
Log1x commented
Any idea what the item is returning as if it isn't a WP_Post
?
huubl commented
Yes, it's returning a WPML_LS_Menu_Item as object
Log1x commented
Yes, it's returning a WPML_LS_Menu_Item as object
oof that's a little frusterating. okay, let me think on it.