Custom results template

Forums › Forums › Search & Filter Pro › Custom results template

Viewing 10 posts – 1 through 10 (of 18 total)
  • Anonymous
    #9434

    Hi,
    I’ve a page that shows all my custom posts (“movie”) using my custom template with get_posts loop:

    $args = array( 
      'numberposts'		=> -1,
      'post_type'		=> 'movie',
    );
    
    $myposts = get_posts($args);
    
    foreach ($myposts as $mypost):
      echo '<div class="my_custom_template">'. get_the_title($mypost->ID) .'</div>';
    endforeach;

    When I use the filters it doesn’t work. I only want that the filter acts on the results with my custom template. How can do it?

    Anonymous
    #9436

    Could you tell me step by step what I have to do for get what I need? Thanks

    Anonymous
    #9439

    I tried also this way. Create a file called archive-movie.php (where “movie” is my CPT) and entered this code (no get_posts loop):

    <div id="content">
      
    <?php 
    if(have_posts()) : while(have_posts()) : the_post();
    	echo '<b>'.the_title().'</b>';
    	echo '<div class="my-styles">';
    	the_content();
    	echo '</div>';
    endwhile; endif;
    ?>
      
    </div>

    On the frontend, at the url http://localhost/mysite/movie I see all the results. When change the filter, Ajax starts (gives opacity on the results) but when finished the results are the same as before. It doesn’t filter…

    Ross Moderator
    #9463

    Hey Gianluca

    Please make sure you are using S&F 1.4.0, then:

    1) click “display results”
    2) click “as archive”
    3) tick “use custom template”
    4) enter in teh custom template name “archive-movie.php” if it is in your the root of your theme…

    Thanks

    Anonymous
    #9880
    This reply has been marked as private.
    Anonymous
    #9927
    This reply has been marked as private.
    Ross Moderator
    #9930
    This reply has been marked as private.
    Anonymous
    #9950
    This reply has been marked as private.
    Ross Moderator
    #9973
    This reply has been marked as private.
    Anonymous
    #10021
    This reply has been marked as private.
Viewing 10 posts – 1 through 10 (of 18 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.