• Resolved paprika27

    (@paprika27)


    I do

    function add_search(){
    echo '<form role="search" method="get" id="searchform" class="searchform" action="https://127.0.0.1:4001/wordpress/sample-page/support/suchergebnisse">
    				<div>
    					<label class="screen-reader-text" for="s">Suchergebnisse für:</label>
    					<input type="text" value="" name="s" data-swplive="true" data-swpengine="default" data-swpconfig="default" id="s" autocomplete="off" placeholder="Suchbegriff eingeben">
    					<button type="submit" id="searchsubmit"><span class="hidden">submit</span></button>
    				</div>
    			</form>';
    }
    add_action('__after_navbar', 'add_search');

    which correctly leads me to

    https://127.0.0.1:4001/wordpress/sample-page/support/suchergebnisse/?s=

    However, as soon as I enter a term, such that

    https://127.0.0.1:4001/wordpress/sample-page/support/suchergebnisse/?s=term

    I get 404.

    the page sample-page/support/suchergebnisse has the default template copied to search.php:

    https://pastebin.com/RvSFL1Zh

    and no content added by me.

    If I do https://127.0.0.1:4001/wordpress/?s=test I receive a working search results page (which I assume uses the default template).

    Please help!
    Thanks

    • This topic was modified 7 years, 12 months ago by paprika27.
Viewing 2 replies - 1 through 2 (of 2 total)
  • I am not sure if this is a problem with the theme itself. But the following article may put some lights in understanding how WP search works:

    https://lorelle.wordpress.com/2006/02/11/understanding-and-fixing-wordpress-search/

    Thread Starter paprika27

    (@paprika27)

    I changed my searchform to

    function add_search(){
    echo '<div id="searchwrapper">
    		<input type="checkbox" name="toggle" id="searchtoggle" /><label for="searchtoggle"></label>
    		<form id="searchform" class="searchform" onsubmit="return false;">
    			<label class="screen-reader-text" for="s">Suche nach:</label>
    			<input type="text" value="" name="s" data-swplive="true" id="s" autocomplete="off" placeholder="Suchbegriff eingeben">
    		</form>
    	</div>';
    }
    add_action('__after_navbar', 'add_search');

    to avoid redirection to a queried page altogether (return false onsubmit) and started using searchwp-live-ajax-search plugin as a workaround.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘change search results page’ is closed to new replies.