Forums Forums Search & Filter Pro Multiple forms with shortcodes and different templates

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #26155

    Hi,

    You suggest this:

    Multiple Search Forms, – I don’t want all my results looking the same!?

    For example, if a Search Form had an ID of 14, then I would create a template in this folder called 14.php – that only this Search Form could use for displaying its results – the file would then be located: wp-content\themes\your-theme-name\search-filter\14.php

    The problem is that not always the ID is known. For example I work in local server, the when I upload the page to production the ID’s is different.

    My first attemp was:

    result.php

    <?php
    while ($query->have_posts())
    {
     $query->the_post();	
     ?>		
     <?php 
      if (is_page_template("custom-mycpt.php"))
       get_template_part ('templates/item','mycpt'); 
      else 
       get_template_part ('templates/item','posts'); 
     ?>			
    <?php
    }
    ?>

    The problem is using Ajax when refresh ‘is_page_template’ don’t works correctly.

    My second attemp is:

    if ($query->query['post_type'][0] == 'mycpt')
     get_template_part ('templates/item','mycpt');
    else
     get_template_part ('templates/item','posts');

    This works fine but I don’t know is a good solution.

    Thanks.

    Ross Moderator
    #26212

    Hey Jose

    Yeah unfortunately you will have to rename the php files to match the IDs of your search form in your environment.

    What I’m planning to do is an option so you can give a “name” to search form – so that it has its own slug based on name, and not ID. This way, even if the search form IDs don’t match you won’t have any problems.

    Sticking this on my to do list now.

    Thanks

    Anonymous
    #52191

    Hi,

    Any news of this?

    To name the search form will a perfect solution.

    Trevor
    #52303

    We are working on this right now (today) with the hope that it will appear in the next released version (2.2.0), which we hope to be today, as it happens.

    Trevor
    #52409

    2.2.0 is now released. I believe it has the naming feature you requested. Is it OK to close this thread now and mark it resolved?

    Anonymous
    #52417

    Exactly that! thanks

Viewing 6 posts - 1 through 6 (of 6 total)