Advertisement
dgpope

Page for ajax encyclopedia

Mar 9th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1. <article>
  2. <?php
  3. /**
  4.  * Template name: AJAX Encyclopedia
  5.  *
  6.  */
  7. ?>
  8. <script type="text/javascript">
  9.  
  10. jQuery( document ).on( 'ajaxfinish', easy_fancybox_handler );
  11. </script>
  12. <?php
  13.  
  14.  
  15. add_action( 'genesis_entry_content', 'glossary_filter');
  16.  
  17. function glossary_filter()
  18. {
  19. $args = array(
  20.     'post_type' => 'encyclopedia_item',
  21.     'posts_per_page' => -1,
  22.     'order'   => 'ASC',
  23.     'paged'          => get_query_var( 'paged' )
  24. );
  25.  
  26. $query = new WP_Query( $args );
  27.  
  28. $tax = 'encyclopedia_category';
  29. $terms = get_terms( $tax );
  30. $count = count( $terms );
  31.  
  32. if ( $count > 0 ): ?>
  33.  
  34.  
  35. <?php endif;
  36. if ( $query->have_posts() ): ?>
  37. <div class="full-width-content">
  38. <div class="one-half">
  39. <div class="full-width-content" id="post-content">
  40. <div id="loading-animation">
  41. </div>
  42. </div>
  43. <div class="full-width-content" id="related-terms">
  44. related terms
  45. </div>
  46. </div>
  47. <div class="one-half">
  48.     <div class="post-tags">
  49.     <?php
  50.     foreach ( $terms as $term ) {
  51.         $term_link = get_term_link( $term, $tax );
  52.         echo '<a href="' . $term_link . '" class="term-filter" title="' . $term->slug . '">' . $term->name . '</a> ';
  53.     } ?>
  54.     </div>
  55. <div class="tagged-posts">
  56.     <ul>
  57.     <?php while ( $query->have_posts() ) : $query->the_post(); ?>
  58.  
  59.     <li class="parent" id="<?php the_ID(); ?>" >
  60.     <a class="ajax-click" href="#"><?php the_title(); ?></a>
  61.     <div class="child">
  62.     <?php the_content() ?>
  63.     </div>
  64.     </li>
  65.  
  66.     <?php endwhile; ?>
  67.         </ul>
  68. </div>
  69. <?php do_action( 'genesis_after_endwhile' ); ?>
  70. <?php else: ?>
  71.     <div class="tagged-posts">
  72.         <h2>No posts found</h2>
  73.     </div>
  74.     </div>
  75.     </div>
  76. <?php endif; ?>
  77. <?php } ?>
  78.  
  79. </article>
  80. <?php
  81. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement