[Support request] Search results in different pages

Home Forums Support [Support request] Search results in different pages

Home Forums Support Search results in different pages

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1464928
    Nacho

    Hello,

    I was just wondering if it would be possible to show in the search results page only the results from a category page.

    So for example I´ve a category called blog which is the archive page for posts with the category called “blog” but I also have a category called “asesoria” and a page as well. So in the blog´s search box I just want the results page to show items from the “blog” category and if you make the search from the “asesoria” page, just show the results with the category of “asesoria”.

    I hope that´s possible.

    Thanks a lot team 🙂

    #1465016
    David
    Staff
    Customer Support

    Hi there,

    The search form would need to include the query parameter for the current category. It looks like you’re using Elementor to create the form, so you would need to ask their support if thats possible.

    #1465030
    Nacho

    Hello David,

    How would you do in the page that does not use elementor?

    Because in the blog page I´m not using it.

    Thanks a lot.

    #1465061
    David
    Staff
    Customer Support

    You would create your own search form in a HTML Widget like so:

    <form method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
        <input type="hidden" name="cat" id="cat" value="5" />
        <input type="text" size="16" name="s" value="Search"  />
        <input type="submit" value="Go" />
    </form>

    You would change the value="5" to match the ID of the Blog category.

    #1466792
    Nacho

    Hello David,

    Great, let´s try it out.

    Thanks a lot.

    #1466984
    David
    Staff
    Customer Support

    You’re welcome

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