• I am using Elementor to create custom templates for my website.

    Situation: I want to have multiple search landing pages, each for a different post type (e.g. a separate search page for posts, clubs, and events).

    My solution: I was going to add the following code into my functions.php file. I check if the incoming query is a search, and depending on if it’s from the “articles”, “club”, etc., form then I would redirect the page to a certain template.

    Problem: The only problem is I don’t know the file path to the Elementor templates to use load_template(). I’ve looked high and low on the internet and in my wp-content folder but still couldn’t find anything. I also tried using the shortcode Elementor provides to the template but that didn’t work.

    I appreciate all help! Also, if anyone knows another way to do this, please let me know.

    
    //HTML Form
    <form role='search' method='get' class='search-form' action='https://chess-intellect.local' id='sidebar-search'>
    	<input type='search' class='search-field' placeholder='Search...' name='s' />
    	<input type='hidden' name='search-type' value='articles' />
    </form>
    
    
        // redirect searches from form to a template
        add_filter( 'template_include', 'search_redirect');
    
    function search_redirect() {
        if(is_search() && isset($_GET['search-type'])) {
    
            $type = $_GET['search-type'];
                if($type == 'articles') {
                    // I want to use load_template() but can't :(
                    do_shortcode('[elementor-template id="1818"]');
                } else if($type == 'clubs') {
                   // load clubs template
               }
        }
    }
    
  • The topic ‘What’s the File Path to Elementor Templates’ is closed to new replies.