Skip to content

Instantly share code, notes, and snippets.

@cccamuseme
Created March 3, 2017 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cccamuseme/666004680879bdf0c78bd68233f0de61 to your computer and use it in GitHub Desktop.
Save cccamuseme/666004680879bdf0c78bd68233f0de61 to your computer and use it in GitHub Desktop.
Single Project post type template
<?php
/**
* The template for displaying all single posts.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Mindspike
*/
get_header(); ?>
<div class="full-width-page-header">
<div class="container">
</div>
</div>
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
<!-- Start the Loop. -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="single-project-page">
<div class="single-project-wrapper">
<div class="project-flex-wrapper">
<div class="project-content">
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
</div>
<div class="project-featured" style="background-image: url('<?php echo $thumb['0'];?>')">
</div>
</div><!-- /.project-flex-wrapper -->
<div class="project-flex-wrapper">
<div class="project-img">
<img src="<?php the_field('project_image_1'); ?>" />
</div>
<div class="project-img">
<img src="<?php the_field('project_image_2'); ?>" />
</div>
<div class="project-img">
<img src="<?php the_field('project_image_3'); ?>" />
</div>
</div><!-- /.project-flex-wrapper -->
<div class="project-flex-wrapper">
<div class="project-previous">
<?php $prev_post = get_adjacent_post( true, '', true, 'web-design' ); ?>
<?php if ( is_a( $prev_post, 'WP_Post' ) ) { ?>
<a href="<?php echo get_permalink( $prev_post->ID ); ?>"><?php echo get_the_title( $prev_post->ID ); ?></a>
<?php } ?>
</div>
<div class="project-portfolio">
<a href="http://mindcloak.com/mindspikenew/web-design/">BACK TO PROJECTS</a>
</div>
<div class="project-next">
<?php $next_post = get_adjacent_post( true, '', false, 'web-design' ); ?>
<?php if ( is_a( $next_post, 'WP_Post' ) ) { ?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo get_the_title( $next_post->ID ); ?></a>
<?php } ?>
</div>
</div>
</div><!-- /.single-project-wrapper -->
</div><!-- /.single-project-page -->
<!-- Stop The Loop (but note the "else:" - see next line). -->
<?php endwhile; else : ?>
<!-- REALLY stop The Loop. -->
<?php endif; ?>
<?php
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment