pedmands

index.php

Oct 7th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The main template file.
  4.  *
  5.  * This is the most generic template file in a WordPress theme
  6.  * and one of the two required files for a theme (the other being style.css).
  7.  * It is used to display a page when nothing more specific matches a query.
  8.  * E.g., it puts together the home page when no home.php file exists.
  9.  *
  10.  * @link https://codex.wordpress.org/Template_Hierarchy
  11.  *
  12.  * @package Lance
  13.  */
  14.  
  15. get_header(); ?>
  16.  
  17.     <div id="primary" class="content-area">
  18.         <main id="main" class="site-main" role="main">
  19.  
  20. <?php
  21.     $projects = array(
  22.     'post_type' =>'project',
  23.     'orderby' => 'rand'
  24.     );
  25.     $project_tiles = new WP_Query($projects);?>
  26.  
  27.  
  28. <div id="projects">
  29.     <?php while ( $project_tiles->have_posts() ) : $project_tiles->the_post();
  30.         echo '<div class="project hvr-float">';
  31.         echo '<a class="" href="' . get_permalink() . '" title="Learn more about ' . get_the_title() . '">';
  32.         echo '<span class="cover">';
  33.         the_post_thumbnail('project-thumb');
  34.         echo '<div class="project-caption">';
  35.         echo '<h1 class="project-title">' . get_the_title() . '</h1>';
  36.         if ( 'projects' == get_post_type()) {
  37.             if (has_term('','clients')){
  38.                 echo get_the_term_list($post->ID, 'client', '<h1 class="project-client">', '</h1><h1 class="project-client">', '</h1>' );
  39.             } else {
  40.                 echo get_the_term_list($post->ID, 'director', '<h1 class="project-client">', '</h1><h1 class="project-client">', '</h1>' );
  41.             }
  42.         } else {
  43.             if (has_term('', 'year')){
  44.                 echo get_the_term_list($post->ID, 'year', '<h1 class="project-client">', '</h1><h1 class="project-client">', '</h1>' );
  45.             } else {
  46.                 echo get_the_term_list($post->ID, 'director', '<h1 class="project-client">', '</h1><h1 class="project-client">', '</h1>' );
  47.             }
  48.         }
  49.         echo '</div>';
  50.         echo '</span>';
  51.         echo '</a>';
  52.         echo '</div>';
  53.     endwhile;
  54.  
  55.  
  56.     wp_reset_query();
  57.  
  58.  
  59.     ?>
  60.  
  61.  
  62.  
  63.         </main><!-- #main -->
  64.     </div><!-- #primary -->
  65.  
  66. <?php
  67. get_sidebar();
  68. get_footer();
Add Comment
Please, Sign In to add comment