Advertisement
Guest User

Custom Post Type, the single-.php problem

a guest
Jan 1st, 2014
1,670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The Template for displaying all Single Project posts.
  4.  *
  5.  * @package WordPress
  6.  * @subpackage Laurel Streng
  7.  * @since Laurel Streng 2.0
  8.  */
  9.  
  10. get_header(); ?>
  11.  
  12. <?php $portfolio = new WP_Query(array(
  13.     'post_type' => 'project'
  14. )); ?>
  15. <?php while($portfolio->have_posts()) : $portfolio->the_post(); ?>
  16.  
  17. <?php if ( is_single() ) : ?>
  18.  
  19. <div class="row" role="main">
  20.     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  21.         <header class="project-header large-12 columns">
  22.             <h1 class="entry-title"><?php the_title(); ?></h1>
  23.             <p><?php the_terms($post->ID, 'project_type', '', '  <span class="color">|</span> ', ' ' ); ?></p>
  24.         </header>
  25.  
  26.         <div class="large-6 columns">
  27.             <?php the_field('project_description'); ?>
  28.             <table>
  29.                 <tbody>
  30.                     <tr>
  31.                         <td>Client:</td>
  32.                         <td><?php the_field('project_client'); ?></td>
  33.                     </tr>
  34.                     <tr>
  35.                         <td>Date:</td>
  36.                         <td><?php the_field('project_date'); ?></td>
  37.                     </tr>
  38.                     <tr>
  39.                         <td>Skills:</td>
  40.                         <td>
  41.                             <?php
  42.                             $values = get_field('project_skills');
  43.                             if($values) {
  44.                                 foreach($values as $value) {
  45.                                     echo $value . ', ';
  46.                                 }
  47.                             } ?>
  48.                         </td>
  49.                     </tr>
  50.                 </tbody>
  51.             </table>
  52.             <?php if(get_field('project_url')): ?>
  53.                 <a class="button small radius" href="<?php the_field('project_url'); ?>" target="_blank">Launch Project</a>
  54.             <?php endif; ?>
  55.         </div>
  56.  
  57.         <div class="large-6 columns">
  58.         </div>
  59.  
  60.         <?php if ( is_search() ) : // Only display Excerpts for Search ?>
  61.         <div class="entry-summary large-12 columns">
  62.             <?php the_excerpt(); ?>
  63.         </div>
  64.         <?php else : ?>
  65.         <?php endif; ?>
  66.     </article>
  67. </div>
  68. <?php endif; // is_single() ?>
  69.  
  70. <?php endwhile; ?>
  71. <?php wp_reset_postdata(); ?>
  72.  
  73. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement