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

    Hi,
    I need to force Enfold to show all search results even if search query ( ?s= ) is empty.
    That would be the default Wp behaviour, actually.

    Any help?

    #1080576

    Hey aledef,

    Thank you for using Enfold.

    Could you explain the issue further? The theme doesn’t alter the default search functionality.

    Best regards,
    Ismael

    #1080780

    Hi Ismael,
    if you do search for an empty search query ( ?s= ) when Enfold is actvive then you get no results and a page whose title is: “To search the site please enter a valid term”. Please see here:
    https://kriesi.at/themes/enfold/?s=

    If you do the same when a default theme ( Twenty nineteeen, Twenty Seventeen, Twenty Sixteen, etc.. ) is active then you get all results, which is default WP behaviuor. I tryed this on a test website with Wp up to date and no other plugin active.

    It looks like Enfold actually alters the default search functionality.

    #1081288

    Hi,

    I see. In the search.php template, the theme has this condition or logic.

    if(!empty($_GET['s']) || have_posts())
    

    It says that if the search query is not empty or have posts to display, get the search template. It’s not going to display anything if the search is empty. Maybe, the search template on the default themes are different.

    Best regards,
    Ismael

    #1081370

    Hi,
    I guess I’ll have to modify search.php in child theme then.

    #1081835

    Hi,

    Yes, you can query all existing posts and render them in the page if the search query is empty. I’m sure you’ll be able to find the code in the default themes.

    Best regards,
    Ismael

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