Dieser Benutzer hat keine Lieblingsthemen.
Bevorzugte Forumsthemen
Forumsthemen erstellt
Status |
Thema
|
Unterstützer | Stimmen | Beiträge | Frische |
---|---|---|---|---|---|
Adding custom menu items before the language switcher
Angefangen von: a.N
in: Suporte em português
Problem: add_filter('wp_nav_menu_items', 'add_custom_menu_items_before_wpml', 10, 2);<br />function add_custom_menu_items_before_wpml($items, $args) {<br /> // Your new menu item(s)<br /> if (is_user_logged_in()) {<br /> $custom_items = '<li><a href="' . esc_html_x('/conta/', 'Botão no menu de navegação URL', 'lwp') . '">' . esc_html_x('Conta ', 'Botão no menu de navegação', 'lwp') . '</a> </li>';<br /> $custom_items .= '<li><a href="' . wp_logout_url() . '">' . esc_html_x('Sair ', 'Botão no menu de navegação', 'lwp') . '</a> </li>';<br /> } else {<br /> $custom_items = '<li><a href="' . wp_registration_url() . '">' . esc_html_x('Registar ', 'Botão no menu de navegação', 'lwp') . '</a> </li>';<br /> $custom_items .= '<li><a href="' . esc_html_x('/conta/', 'Botão no menu de navegação URL', 'lwp') . '">' . esc_html_x('Entrar ', 'Botão no menu de navegação', 'lwp') . '</a> </li>';<br /> }<br /> // Find the WPML language switcher and insert before it<br /> $pattern = '/(<li[^>]*class="[^"]*menu-item-wpml-ls[^"]*"[^>]*>)/i';<br /> if (preg_match($pattern, $items, $matches)) {<br /> $items = preg_replace($pattern, $custom_items + $matches[1], $items, 1);<br /> } else {<br /> // Fallback if language switcher not found — append instead<br /> $items += $custom_items;<br /> }<br /> return $items;<br />} This solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If this does not resolve your issue, please open a new support ticket at WPML support forum. |
|
0 | 8 | Vor 6 Tage, 2 Stunden | |
translating plugin
Angefangen von: a.N in: English Support |
|
2 | 4 | Vor 10 Monaten, 3 Wochen | |
Some string translations not showing on the frontend
Angefangen von: a.N in: Suporte em português |
|
2 | 13 | Vor 2 Jahren | |
Manual subscription for a year
Angefangen von: a.N in: Chat Support |
|
1 | 2 |
Vor 4 Jahren, 11 Monaten
|