Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * The template for displaying all single posts.
- *
- * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
- *
- * @package Sasha_Wolf
- /*
- * Loop through post objects (assuming this is a multi-select field) ( setup postdata )
- * Using this method, you can use all the normal WP functions as the $post object is temporarily initialized within the loop
- * Read more: http://codex.wordpress.org/Template_Tags/get_posts#Reset_after_Postlists_with_offset
- */
- $post_objects = get_field('exhibition_links');
- if( $post_objects ): ?>
- <?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
- <?php setup_postdata($post); ?>
- <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
- <?php endforeach; ?>
- <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
- <?php endif;
- */
- <?php
- get_header(); ?>
- <div id="primary" class="content-area single-artist">
- <main id="main" class="site-main" role="main">
- <a href="<?php the_permalink(); ?>"><?php the_title( '<h1 class="entry-title">', '</h1>' ); ?></a>
- <div class="artist-menu single-menu">
- <ul>
- <?php
- // check if the repeater field has rows of data
- if( have_rows('image_gallery') ):
- // loop through the rows of data
- while ( have_rows('image_gallery') ) : the_row();
- ?>
- <li><a href="#" class="gallery-link">
- <?php the_sub_field('gallery_title');?>
- </li></a>
- <?php endwhile;
- else :
- // no rows found
- endif;
- ?>
- <?php
- /*
- * Loop through post objects (assuming this is a multi-select field) ( don't setup postdata )
- * Using this method, the $post object is never changed so all functions need a seccond parameter of the post ID in question.
- */
- $post_objects = get_field('post_objects');
- if( $post_objects ): ?>
- <ul>
- <?php foreach( $post_objects as $post_object): ?>
- <li>
- <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
- <span>Post Object Custom Field: <?php the_field('field_name', $post_object->ID); ?></span>
- </li>
- <?php endforeach; ?>
- </ul>
- <?php endif;
- ?>
- <li style="margin-top:24px;"><a href="#" class="biography-link">Biography</a>
- <li><a href="#" class="press-link">Press</a>
- </ul>
- <span class="disclaimer">
- Images shown on the site are just a small sample of works available by the artists.
- </span>
- </div>
- <div class="artist-content">
- <div class="post-thumbnail toggle">
- <?php
- if ( has_post_thumbnail() ) {
- the_post_thumbnail('large');
- }
- ?>
- </div>
- <div class="biography toggle">
- <h2>Biography</h2>
- <div class="absolute-clear">
- <?php the_field('biography'); ?>
- </div>
- </div>
- <div class="press toggle">
- <h2>Press</h2>
- <div class="absolute-clear">
- <?php the_field('press'); ?>
- </div>
- </div>
- <!-- CHECK OUT REPEATER "gallery-repeater" -->
- <?php if( have_rows('image_gallery') ): ?>
- <!-- CHECK TO SEE IF IT HAS ROWS IN IT -->
- <?php while ( have_rows('image_gallery') ) : the_row(); ?>
- <div class="image-gallery toggle">
- <!-- DISPLAY THE TEXT-FIELD THEN ASSIGN OUR GALLERY TO VARIABLE $images -->
- <h2><?php echo the_sub_field('gallery_title'); ?></h2>
- <div class="absolute-clear">
- <?php
- $images = get_sub_field('gallery');
- if( $images ):?>
- <?php foreach( $images as $image ): ?>
- <div class="image-wrap">
- <a class="image-link" data-title="<?php echo $image['caption']; ?>" data-lightbox="go" href="<?php echo $image['url']; ?>">
- <img src="<?php echo $image['sizes']['medium']; ?>" alt="<?php echo $image['alt']; ?>" />
- </a>
- <p class="image-caption"><?php echo $image['caption']; ?></p>
- </div>
- <?php endforeach; ?>
- <?php endif;
- ?>
- </div></div>
- <?php
- endwhile;
- else :
- // no rows found
- endif; ?>
- </div><!-- .artist-content -->
- </main><!-- #main -->
- </div><!-- #primary -->
- <?php
- //get_sidebar();
- get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement