Advertisement
Guest User

template-west-end-sortable.php

a guest
Jan 20th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. <?php /* Template Name: West End (Sortable) */ ?>
  2.  
  3. <?php get_header(); ?>
  4.  
  5. <main id="content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
  6.  
  7. <header class="entry-header" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
  8.  
  9. <?php if ( has_post_thumbnail() ) : ?>
  10. <div class="entry-image">
  11. <?php the_post_thumbnail( 'l' ); ?>
  12. </div>
  13. <?php endif; ?>
  14.  
  15. <h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1>
  16.  
  17. </header>
  18.  
  19. <?php if ( has_excerpt() ) : ?>
  20.  
  21. <div class="entry-excerpt" itemprop="text">
  22. <?php the_excerpt(); ?>
  23. </div>
  24.  
  25. <?php endif; ?>
  26.  
  27. <?php
  28. $args = array(
  29. 'post_type' => 'west-end',
  30. 'order' => 'DESC',
  31. 'posts_per_page' => -1
  32. );
  33.  
  34. $wp_query = new WP_Query( $args );
  35. ?>
  36.  
  37. <?php if ( $wp_query->have_posts() ) : ?>
  38.  
  39. <?php $terms = get_terms( 'portfolio-type' ); ?>
  40.  
  41. <?php if ( !empty( $terms ) ) : ?>
  42.  
  43. <!-- Filters -->
  44. <div class="portfolio-filter clearfix">
  45. <ul>
  46. <li class="filter-heading"><?php _e( 'Filter:', 'reply' ); ?></li>
  47. <li><a href="<?php get_permalink( $id ); ?>" class="active" data-filter="*"><?php _e( 'All', 'reply' ); ?></a></li>
  48. <?php foreach( $terms as $term ) : ?>
  49. <li><a href="<?php get_term_link( $term ); ?>" data-filter=".<?php echo $term->slug; ?>"><?php echo $term->name; ?></a></li>
  50. <?php endforeach; ?>
  51. </ul>
  52. </div>
  53.  
  54. <?php endif; ?>
  55.  
  56. <div class="portfolio-container clearfix">
  57.  
  58. <?php while ( $wp_query->have_posts() ) : $wp_query->the_post();
  59.  
  60. $terms = get_the_terms( $post->ID, 'portfolio-type' );
  61. $term_list = '';
  62.  
  63. if( !empty( $terms ) ) {
  64. foreach( $terms as $term ) {
  65. $term_list .= "$term->slug" . " ";
  66. }
  67. $term_list = trim( $term_list );
  68. }
  69.  
  70. ?>
  71.  
  72. <!-- Article -->
  73. <article id="post-<?php the_ID(); ?>" <?php post_class( array( $term_list, 'post' ) ); ?> itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  74. <header class="entry-header" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
  75.  
  76. <?php if ( has_post_thumbnail() ) : ?>
  77. <a class="entry-image" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  78. <?php the_post_thumbnail( 's' ); ?>
  79. </a>
  80. <?php endif; ?>
  81.  
  82. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
  83.  
  84. <?php if ( !empty( $terms ) ) : ?>
  85. <em class="entry-meta"><?php foreach( $terms as $term ) { echo $term->name . ', '; } ?></em>
  86. <?php endif; ?>
  87.  
  88. </header>
  89. </article>
  90.  
  91. <?php endwhile; endif; ?>
  92.  
  93. </div><!--/.portfolio-container-->
  94.  
  95. </main>
  96.  
  97. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement