Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.30 KB | None | 0 0
  1. /**
  2.  * The template for displaying all single posts.
  3.  *
  4.  * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
  5.  *
  6.  * @package Sasha_Wolf
  7.  
  8. /*
  9. *  Loop through post objects (assuming this is a multi-select field) ( setup postdata )
  10. *  Using this method, you can use all the normal WP functions as the $post object is temporarily initialized within the loop
  11. *  Read more: http://codex.wordpress.org/Template_Tags/get_posts#Reset_after_Postlists_with_offset
  12. */
  13.  
  14. $post_objects = get_field('exhibition_links');
  15.  
  16. if( $post_objects ): ?>
  17.    
  18.     <?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
  19.         <?php setup_postdata($post); ?>
  20.    
  21.             <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  22.          
  23.      
  24.     <?php endforeach; ?>
  25.    
  26.     <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
  27. <?php endif;
  28.  
  29.  */
  30. <?php
  31. get_header(); ?>
  32.  
  33.     <div id="primary" class="content-area single-artist">
  34.         <main id="main" class="site-main" role="main">
  35.  
  36.     <a href="<?php the_permalink(); ?>"><?php the_title( '<h1 class="entry-title">', '</h1>' ); ?></a>
  37.  
  38. <div class="artist-menu single-menu">
  39. <ul>
  40.  
  41.  
  42.   <?php
  43.  
  44. // check if the repeater field has rows of data
  45. if( have_rows('image_gallery') ):
  46.  
  47.     // loop through the rows of data
  48.     while ( have_rows('image_gallery') ) : the_row();
  49. ?>
  50.  
  51.  
  52.         <li><a href="#" class="gallery-link">
  53.      <?php the_sub_field('gallery_title');?>
  54.         </li></a>
  55.    <?php  endwhile;
  56.  
  57. else :
  58.  
  59.     // no rows found
  60.  
  61. endif;
  62.  
  63. ?>
  64.  
  65.  
  66.  
  67.  
  68. <?php
  69.  
  70.  
  71. /*
  72. *  Loop through post objects (assuming this is a multi-select field) ( don't setup postdata )
  73. *  Using this method, the $post object is never changed so all functions need a seccond parameter of the post ID in question.
  74. */
  75.  
  76. $post_objects = get_field('post_objects');
  77.  
  78. if( $post_objects ): ?>
  79.     <ul>
  80.     <?php foreach( $post_objects as $post_object): ?>
  81.         <li>
  82.             <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
  83.             <span>Post Object Custom Field: <?php the_field('field_name', $post_object->ID); ?></span>
  84.         </li>
  85.     <?php endforeach; ?>
  86.     </ul>
  87. <?php endif;
  88.  
  89. ?>
  90.  
  91. <li style="margin-top:24px;"><a href="#" class="biography-link">Biography</a>
  92. <li><a href="#" class="press-link">Press</a>
  93.   </ul>  
  94.   <span class="disclaimer">
  95.   Images shown on the site are just a small sample of works available by the artists.
  96.   </span>
  97.   </div>
  98.  
  99.  
  100.  
  101.  
  102. <div class="artist-content">
  103. <div class="post-thumbnail toggle">
  104. <?php
  105.  
  106. if ( has_post_thumbnail() ) {
  107.     the_post_thumbnail('large');
  108. }
  109. ?>
  110.  
  111. </div>
  112. <div class="biography toggle">
  113. <h2>Biography</h2>
  114. <div class="absolute-clear">
  115. <?php the_field('biography'); ?>
  116. </div>
  117. </div>
  118.  
  119. <div class="press toggle">
  120. <h2>Press</h2>
  121. <div class="absolute-clear">
  122.  
  123. <?php the_field('press'); ?>
  124. </div>
  125. </div>
  126.    
  127.    
  128.    
  129.    
  130.    
  131.    
  132.     <!-- CHECK OUT REPEATER "gallery-repeater" -->
  133. <?php if( have_rows('image_gallery') ): ?>
  134.  
  135.    <!-- CHECK TO SEE IF IT HAS ROWS IN IT -->
  136.    <?php while ( have_rows('image_gallery') ) : the_row(); ?>
  137. <div class="image-gallery toggle">
  138.      <!-- DISPLAY THE TEXT-FIELD THEN ASSIGN OUR GALLERY TO VARIABLE $images -->
  139.      
  140.      
  141.      <h2><?php echo the_sub_field('gallery_title'); ?></h2>
  142. <div class="absolute-clear">
  143.  
  144.  
  145.  
  146. <?php
  147.      $images = get_sub_field('gallery');
  148.  
  149.      if( $images ):?>
  150.         <?php foreach( $images as $image ): ?>
  151.         <div class="image-wrap">
  152.        <a class="image-link" data-title="<?php echo $image['caption']; ?>" data-lightbox="go" href="<?php echo $image['url']; ?>">
  153.           <img src="<?php echo $image['sizes']['medium']; ?>" alt="<?php echo $image['alt']; ?>" />
  154.            </a>
  155.            <p class="image-caption"><?php echo $image['caption']; ?></p>
  156.            </div>
  157.         <?php endforeach; ?>
  158.      <?php endif;
  159.    
  160.    ?>
  161.    </div></div>
  162.    
  163.    <?php
  164.    
  165.    endwhile;
  166. else :
  167. // no rows found
  168. endif; ?>
  169.  
  170.  
  171.  
  172. </div><!-- .artist-content -->
  173.  
  174.      
  175.  
  176.      
  177.      
  178.      
  179.      
  180.      
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.         </main><!-- #main -->
  206.     </div><!-- #primary -->
  207.  
  208. <?php
  209. //get_sidebar();
  210. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement