naomivd

archive page filtrify

Mar 11th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Archive Recepten
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <section id="primary" class="content-area">
  9. <main id="main" class="site-main" role="main">
  10. <div id="placeholder"></div>
  11. <div id="legend"></div>
  12. <ul id="container" class="search-results-wrap container_3 clearfix">
  13. <?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=25&post_type=post'.'&paged='.$paged); while ($wp_query->have_posts()) : $i++; $wp_query->the_post(); ?>
  14. <li class="result <?php if ( ($i%3) == 0 ) { echo 'grid_1'; } elseif ( ($i%1) == 0 ) { echo 'grid_1'; } ?>" style="height:220px;" data-filter="<?php foreach(get_the_category() as $category) { echo $category->slug . '';} ?>">
  15. <div class="thumbnail-result">
  16. <a href="<?php the_permalink(); ?>" rel="bookmark"> <?php if ( (function_exists('category-thumbnail')) && (has_post_thumbnail()) ) {echo get_the_post_thumbnail($post->ID); } else {echo main_image(); } ?> </a>
  17. </div>
  18. <div class="result-info">
  19. <span class="title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></span>
  20. <span class="date"><?php the_time('d-m-y') ?></span>
  21. </div>
  22. </li>
  23. <?php endwhile; ?>
  24. </ul>
  25.  
  26. <nav>
  27. <?php previous_posts_link('&laquo; Newer') ?>
  28. <?php next_posts_link('Older &raquo;') ?>
  29. </nav>
  30.  
  31. <?php
  32. $wp_query = null;
  33. $wp_query = $temp; // Reset
  34. ?>
  35. </main><!-- #main -->
  36. </section><!-- #primary -->
  37.  
  38. <?php get_sidebar(); ?>
  39. <?php get_footer(); ?>
  40.  
  41. <script>
  42. jQuery(document).ready(function($){
  43. $.filtrify("container", "placeholder", {
  44. close : true,
  45. callback : function( query, match, mismatch ) {
  46. if ( !mismatch.length ) {
  47. $("#legend").html("Viewing all projects");
  48. } else {
  49. var category, tags, i, tag, legend = "<h4>Currently filtered by:</h4>";
  50. for ( category in query ) {
  51. tags = query[category];
  52. if ( tags.length ) {
  53. legend += "";
  54. for ( i = 0; i < tags.length; i++ ) {
  55. tag = tags[i];
  56. legend += "" + tag + "&nbsp;&nbsp;&nbsp;&nbsp;";
  57. };
  58. legend += "";
  59. };
  60. };
  61. $("#legend").html( legend );
  62. };
  63. }
  64. });
  65. });
  66. </script>
Advertisement
Add Comment
Please, Sign In to add comment