[Support request] Search form within a page possible?

Home Forums Support [Support request] Search form within a page possible?

Home Forums Support Search form within a page possible?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #280537
    Roman

    Hello Tom,

    I have a crazy idea. Is it possible to place a search form into a page or a section like this?

    https://www.omnea.de/verzeichnisse/branchenorte/

    I would like to place the search more prominent.
    Roman

    #280649
    Tom
    Lead Developer
    Lead Developer

    Hi Roman,

    You could build a shortcode which you can use like this:

    add_shortcode( 'search', 'tu_search_shortcode' );
    function tu_search_shortcode() {
    	ob_start();
    	get_search_form();
    	$ret = ob_get_contents();
    	ob_end_clean();
    	return $ret;
    }

    Then just use [search] in your content.

    #1374938
    Dan

    Hello Tom. Revisiting this, but tell me if I should start a new topic. Is there a way to constrain this search to the page that it’s on? For example, there are a lot of things on a site that I’m building related to the same words, but I only want to see results on the one page where I put the search bar. Possible?

    #1374959
    Leo
    Staff
    Customer Support

    I don’t think it’s possible to modify WordPress get_search_form(); this way.

    Might be worth asking on a general forum like this and see if anyone has a clever solution:
    https://wordpress.stackexchange.com/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.