• I’m a bit confused.

    Is it possible to link to an empty search page?

    I’m using the nice-search plugin (http://txfx.net/code/wordpress/nice-search/), so that something like say myblog/search/the gives me a results page as you would expect.

    But loading myblog/search/ on it’s own gives me a blank page from the_title downwards.

    I had the same problem before I tried the nice-search plugin so I know it’s not related to that…

    Surely there is way to link to an empty search page? (I’ve got a /search link in my navbar, hence the question)

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter 3stripe

    (@3stripe)

    I have just realised, it’s not actually showing an empty page when I goto myblog/search/, it’s trying to load a 404 page, which I didn’t have defined in my style.

    So including a search box on my 404 page helps a good deal!

    The problem is, you are still taken to myblog/?s= if you then leave the search box blank, and hit enter.

    Is there a way to define this redirect action?

    Maybe it is actually the nice-search plugin that needs some extra code?

    function txfx_nice_search() {
        if ( is_search() && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === false && strpos($_SERVER['REQUEST_URI'], '/search/') === false ) {
            wp_redirect(get_bloginfo('home') . '/search/' . str_replace(' ', '+', str_replace('%20', '+', get_query_var('s'))));
            exit();
        }
    }
    Thread Starter 3stripe

    (@3stripe)

    Or, how can I modify the search form, so that it only submits if the input textarea has something in it!? Maybe that would be easier…

    (Sorry for talking to myself)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to link to an empty search page?’ is closed to new replies.