-
-
Save JRGould/76f636382f5b5c01a3e0 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 | |
/** | |
* The template for displaying single Profiles - taken from Twenty Sixteen | |
* | |
*/ | |
get_header(); ?> | |
<div id="primary" class="content-area"> | |
<main id="main" class="site-main" role="main"> | |
<?php | |
// Start the loop. | |
while ( have_posts() ) : the_post(); | |
$img = get_field( 'profile-photo' ); | |
$bio = get_field( 'bio' ); | |
$img_src = $img[ 'url' ]; | |
$img_w = $img[ 'width' ]; | |
$img_h = $img[ 'height' ]; | |
$img_alt = $img[ 'description' ] ? $img[ 'description' ] : $img[ 'title' ]; | |
$srcset = ''; | |
foreach ( $img[ 'sizes' ] as $key => $val ) { | |
if( strstr( $key, '-width' ) || strstr( $key, '-height' ) ) { | |
continue; | |
} | |
$srcset .= $val . ' ' . $img[ 'sizes' ][ $key . '-width' ] . 'w, '; | |
} | |
$srcset = substr( $srcset, 0, -2 ); | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<header class="entry-header"> | |
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> | |
</header><!-- .entry-header --> | |
<div class="entry-content no-sidebar"> | |
<img src="<?php echo $img_src; ?>" alt="<?php echo $img_alt; ?>" width=100% srcset="<?php echo $srcset; ?>" class="profile-image"> | |
<p><?php echo $bio; ?></p> | |
</div> | |
</article><!-- #post-## --> | |
<?php | |
endwhile; | |
?> | |
</main><!-- .site-main --> | |
<?php get_sidebar( 'content-bottom' ); ?> | |
</div><!-- .content-area --> | |
<?php get_sidebar(); ?> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment