Forums › Forums › Search & Filter Pro › Custom results template
- This topic has 17 replies, 2 voices, and was last updated 9 years, 4 months ago by Anonymous.
-
Anonymous(Private) December 22, 2014 at 8:03 pm #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(Private) December 22, 2014 at 9:17 pm #9439I 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(Private) December 23, 2014 at 2:57 pm #9463Hey 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
-
AuthorPosts