• hey guys.

    im working on a site. im using actually a translation plugin for my translation. but on manual links it doesnt work of course. so i want to check, if the url contains ?lang=en. the probleme here is, that i don’t know the exact position of this string. it can be on the beginning, for example

    https://www.csi.de/?lang=en or at the end, when i click on a page. https://www.csi.de/?pageid=5?lang=en. so i just need a way, how i can check it.

    my actual php code is the following

    <?php
    			if ( is_user_logged_in() && current_user_can('administrator')){
    				$uri = $_SERVER["REQUEST_URI"];
    				$uri_array = split("/",$uri);
    				$uri_first = $uri_array[3]; // might need to change this to [1]
    				echo "HALLO DU" . $uri_first;
    				if ($uri_first == '?lang=en'){
    					wp_list_pages('include=312,269,253,285,325&title_li=Other&sort_column=menu_order');
    				}
    				else{
    					wp_list_pages('include=312,269,253,285,325&title_li=Weiteres&sort_column=menu_order');
    				}
    			}
    			else
    			{
    			wp_list_pages('include=269,253,285,325&title_li=Weiteres&sort_column=ID');
    			//testserver,newsletter,gesetzeslage,agb,impressum
    			}

    thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • I wonder if this would work for you:

    if ( is_user_logged_in() && current_user_can('administrator')){
       $lang = $_GET['lang'];
       if ($lang == 'en'){
          wp_list_pages('include=312,269,253,285,325&title_li=Other&sort_column=menu_order');
       }
       else{
          wp_list_pages('include=312,269,253,285,325&title_li=Weiteres&sort_column=menu_order');
       }
    }
    else{
       wp_list_pages('include=269,253,285,325&title_li=Weiteres&sort_column=ID');
       //testserver,newsletter,gesetzeslage,agb,impressum
    }

    Thread Starter nyp

    (@nyp)

    sorry for my late answer. totally forgot this problem … thx, worked perfect ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if url contains, then’ is closed to new replies.