Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // NUOVO FILTRO LINK ETICHETTA DEL MENU' TEDESCO
- add_filter('wp_setup_nav_menu_item', 'sac_de_menu_link', 20, 1 );
- function sac_de_menu_link( $item_post ) {
- if ('DEUTSCH' == $item_post->title && ! is_admin()) {
- $item_post->url = get_site_url ( null, $_SERVER['REQUEST_URI'] );
- $item_post->url= str_replace ( "://test", "://de.test", $item_post->url );
- $item_post->url= str_replace ( "://en.test", "://de.test", $item_post->url );
- }
- return $item_post;
- }
- // NUOVO FILTRO INGLESE
- add_filter('wp_setup_nav_menu_item', 'sac_en_menu_link', 20, 1 );
- function sac_en_menu_link( $item_post ) {
- if ('ENGLISH' == $item_post->title ) {
- $item_post->url = get_site_url( null, $_SERVER['REQUEST_URI']);
- $item_post->url= str_replace ( "://de.test", "://en.test", $item_post->url );
- $item_post->url= str_replace ( "://test", "://en.test", $item_post->url );
- }
- return $item_post;
- }
- // NUOVO FILTRO LINK MENU' ITALIANO
- add_filter('wp_setup_nav_menu_item', 'sac_it_menu_link', 40, 1 );
- function sac_it_menu_link( $item_post ) {
- if ('ITALIANO' == $item_post->title ) {
- $item_post->url = get_site_url( null, $_SERVER['REQUEST_URI']);
- $item_post->url= str_replace ( "://de.test", "://test", $item_post->url );
- $item_post->url= str_replace ( "://en.test", "://test", $item_post->url );
- }
- return $item_post;
- }
Advertisement
Add Comment
Please, Sign In to add comment