• Resolved kjsf

    (@kjsf)


    When Polylang is active, the search returns no results. I’m using Twenty Eleven as a base.

    I tried removing searchform.php and added

    function my_search_form( $form ) {
    
        $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
        <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
        <input type="text" value="' . get_search_query() . '" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
        </div>
        </form>';
    
        return $form;
    }
    
    add_filter( 'get_search_form', 'my_search_form' );

    in functions.php as described in https://codex.www.ads-software.com/Function_Reference/get_search_form but still no results. Works fine after I deactivate the plugin. I tried adding the search widget (isn’t that the default search form?) to no avail. I’m new to this so I’m kind of lost…

    https://www.ads-software.com/extend/plugins/polylang/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby

    (@chouby)

    Are you using a static page as front page ? I did reproduce the bug in that case. Seems to work fine in other cases.

    Thread Starter kjsf

    (@kjsf)

    Yes, I am. Have any idea how to fix it?

    Plugin Author Chouby

    (@chouby)

    Yes I have ! Waiting for the next release, you can do the modifications yourself by editing polylang.php (v0.4.4)

    Line 82, replace :
    add_filter('get_search_form', array(&$this, 'get_search_form'));
    by:
    add_filter('get_search_form', array(&$this, 'get_search_form'), 99);

    Look for the line 785 which should be :
    $trace['function'] == 'get_author_posts_url' ||
    Add these two lines just below :

    $trace['function'] == 'get_search_form' ||
    (isset($trace['file']) && strpos($trace['file'], 'searchform.php')) ||

    It corrected the bug on my test site. Tell me if it’s OK for you.

    Thread Starter kjsf

    (@kjsf)

    Seems to be working – thank you very much, you’re the best! Keep up the good work. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Polylang] Can't get search to work’ is closed to new replies.