• Resolved wpaadmin

    (@wpaadmin)


    Is it possible to open a custom search results page for each search box?

    If not yet, will you consider adding this as a feature?

    (Unless there’s a way to do it in WordPress already…) Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sumit Singh

    (@5um17)

    Hi,

    There is no such feature yet. But I can help you with custom code.
    If you are using custom search form from WPES. You can create template in theme with their ID in template name. For example to target the search results from search setting ID 21 create the search template search-21.php and then add this code in theme functions.php

    add_filter('template_include', 'wpes_support_15956511', 99);
    function wpes_support_15956511($template) {
        if (function_exists('WPES') && is_search()) {
            $template_name = 'search-' . WPES()->current_setting_id . '.php';
            $new_template = locate_template(array($template_name));
            if ('' != $new_template) {
                return $new_template;
            }
        }
        return $template;
    }

    And you can create more template with same format.

    I hope it helps!

    Thread Starter wpaadmin

    (@wpaadmin)

    Thank you! But I can’t get that to work (I’m sure I’m missing something).

    Is it supposed to work like this? I put a search form shortcode [wpes_search_form wpessid=’402′] on any page, search for a string, and the results show up on page search-402.php?

    I have made a copy of search.php and renamed it search-402.php. Added the code you provided via a snippet plugin.

    Search results still show up on the default search page. What am I missing?

    Plugin Author Sumit Singh

    (@5um17)

    Hi,

    Yes you have followed the correct steps. Not sure what is wrong with the output because it works here on my system.
    Maybe you can share the link of site to take a look?
    If you don’t have a live site you can create a test site here https://tastewp.com/ and share the link.

    Thanks

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