Created
September 1, 2018 16:28
-
-
Save waseemnawaz/06d1ee1e548a668d035ff7025d536c0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Candid | |
*/ | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post' ); ?>> | |
<header class="entry-header"> | |
<?php if ( is_single() ) { ?> | |
<h1 class="entry-title"><?php the_title(); ?></h1> | |
<?php } else { ?> | |
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> | |
<?php } ?> | |
<div class="byline"> | |
<span><?php the_author_posts_link(); ?></span> | |
<span><?php echo get_the_date(); ?></span> | |
<span> | |
<a href="<?php the_permalink(); ?>#comments" title="<?php esc_attr_e( 'Comments on', 'candid' ); ?> <?php the_title(); ?>"> | |
<?php | |
printf( | |
esc_html( _nx( 'One Comment', '%1$s Comments', get_comments_number(), 'comments title', 'candid' ) ), | |
number_format_i18n( get_comments_number() ), get_the_title() ); | |
?> | |
</a> | |
</span> | |
</div> | |
</header><!-- .entry-header --> | |
<!-- Grab the video --> | |
<?php if ( get_post_meta( $post->ID, 'array-video', true ) ) { ?> | |
<div class="featured-video"> | |
<?php echo get_post_meta( $post->ID, 'array-video', true ) ?> | |
</div> | |
<?php } else if ( has_post_thumbnail() ) { ?> | |
<!-- Grab the featured image --> | |
<div class="featured-image fadeInUpImage"><?php the_post_thumbnail( 'candid-full-width' ); ?></div> | |
<?php } ?> | |
<!-- Grab the excerpt to use as a byline --> | |
<?php if ( has_excerpt() ) { ?> | |
<div class="entry-excerpt"> | |
<?php the_excerpt(); ?> | |
</div> | |
<?php } ?> | |
<div class="entry-content"> | |
<?php the_content( esc_html__( 'Read More', 'candid' ) ); ?> | |
<?php | |
wp_link_pages( array( | |
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'candid' ), | |
'after' => '</div>', | |
) ); | |
?> | |
</div><!-- .entry-content --> | |
<?php get_template_part( 'template-parts/content-meta' ); ?> | |
</article><!-- #post-## --> | |
<h1 class="site-title">This maker's work</h1> | |
<?php | |
$relatedProjects = get_field('related_projects'); | |
//$image_class = 'without-featured-image'; | |
//$gallery_size = get_option( 'candid_customizer_gallery_style', 'portfolio-grid-medium' ); | |
if ($relatedProjects){ ?> | |
<div id="post-wrapper"> | |
<div class="gallery-wrapper"> | |
<?php foreach($relatedProjects as $project){ | |
// Check for a featured image | |
$show_titles = get_option( 'candid_customizer_show_titles', 'hover' ); | |
if ( $show_titles == 'show' ) { | |
$image_class = 'without-featured-image'; | |
} else { | |
$image_class = has_post_thumbnail() ? 'with-featured-image' : 'without-featured-image'; | |
} | |
// Get the gallery size | |
$gallery_size = get_option( 'candid_customizer_gallery_style', 'portfolio-grid-medium' ); | |
?> | |
<div <?php post_class( 'gallery-thumb post' ); ?>> | |
<a class="gallery-thumb-image <?php echo esc_attr( $image_class ); ?>" href="<?php echo get_the_permalink($project); ?>" title="<?php the_title_attribute($project); ?>"> | |
<!-- Grab the image, or the fallback image --> | |
<?php if ( has_post_thumbnail() ) { | |
//the_post_thumbnail( 'candid-' . $gallery_size ); | |
echo get_the_post_thumbnail( $project ); | |
} else { ?> | |
<!-- Use a fallback image to keep the grid tidy --> | |
<img class="fallback" src="<?php echo get_template_directory_uri(); ?>/images/fallback.jpg" alt="fallback" /> | |
<?php } ?> | |
</a> | |
<!-- Overlay title and categories --> | |
<div class="photo-overlay <?php echo $image_class; ?>"> | |
<div class="photo-overlay-text"> | |
<h3 class="entry-title"><?php echo get_the_title($project); ?></h3> | |
<?php if ( has_category() ) { ?> | |
<div class="overlay-cats"> | |
<?php | |
// Limit the number of categories output on the grid to 5 to prevent overflow | |
$i = 0; | |
foreach( ( get_the_category($project) ) as $cat ) { | |
echo '<a href="' . esc_url( get_category_link( $cat->cat_ID ) ) . '">' . $cat->cat_name . '</a>'; | |
if ( ++$i == 5 ) break; | |
} | |
?> | |
</div> | |
<?php } ?> | |
</div> | |
</div><!-- .photo-overlay --> | |
</div> | |
<?php } ?> </div></div><?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment