Support » Plugin: Polylang » [Plugin: Polylang] is_search() not working

  • Resolved RRikesh

    (@rrikesh)


    Hello Chouby

    I have a problem on my search results page. The function is_search() isn’t being triggered. I tried other is_xxx() functions and saw that it is is_tax() that is being triggered with the language name as term – tested with the following code:

    $term = $wp_query->get_queried_object();
    $title .= $term->name;

    The url structure of the results page is:
    [domain-name]/[LANG]/?s=[query]

    From the url structure, I guess it is because the language is being considered as a taxonomy that is_tax() is being triggered.

    For the time being I’m using this hack when using is_tax() to detect the results page:

    if( 'English' == $term->name || 'Fran├žais' == $term->name ){
          if( function_exists( 'pll_register_string' ) ){
            $title .= pll__( 'Results Page' );
          }
        }

    Is there any direct way to detect the search result using is_search() or the method mentioned above is the good way to proceed?

    Polylang Version: 0.9.3

    http://wordpress.org/extend/plugins/polylang/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Polylang] is_search() not working’ is closed to new replies.