pedmands

single.php

Oct 7th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying all single posts.
  4.  *
  5.  * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
  6.  *
  7.  * @package Lance
  8.  */
  9.  
  10. get_header(); ?>
  11.  
  12.     <div id="primary" class="content-area">
  13.         <main id="main" class="site-main" role="main">
  14.  
  15.         <?php
  16.         while ( have_posts() ) : the_post();
  17.  
  18.         $prevPost = get_previous_post();
  19.         $prevThumbnail = get_the_post_thumbnail( $prevPost->ID, 'project-thumb');
  20.         $prevTitle = get_the_title($prevPost->ID);
  21.         $nextPost = get_next_post();
  22.         $nextThumbnail = get_the_post_thumbnail( $nextPost->ID, 'project-thumb');
  23.         $nextTitle = get_the_title($nextPost->ID);
  24.  
  25.         get_template_part( 'template-parts/content', get_post_format() );
  26.         ?>
  27.  
  28.        
  29.         <?php endwhile; // End of the loop. ?>
  30.  
  31.         </main><!-- #main -->
  32.  
  33.     </div><!-- #primary -->
  34.     <div class="project-nav">
  35.    
  36.         <div class="p-nav">
  37.             <div class="p-box">
  38.                 <?php if ($prevPost) : ?>
  39.                 <h5 class="p-post">Previous:</h5>
  40.                 <?endif;?>
  41.                 <?php
  42.                     previous_post_link( '%link', '<span class="p-button">' . $prevThumbnail . '<h4 class="p-title">' . $prevTitle . '</h4></span>' ); ?>
  43.             </div> <!-- p-box -->
  44.         </div> <!-- p-nav -->
  45.        
  46.             <a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="b-back-to-all">
  47.                 Back To All
  48.             </a>
  49.        
  50.        
  51.  
  52.         <div class="n-nav">
  53.             <div class="n-box">
  54.             <?php if ($nextPost) : ?>
  55.                 <h5 class="n-post">Next:</h5>
  56.             <? endif; ?>
  57.                 <?php
  58.                     next_post_link( '%link', '<span class="n-button">' . $nextThumbnail . '<h4 class="n-title">' .  $nextTitle . '</h4></span>' );
  59.                 ?>
  60.             </div>
  61.         </div>
  62.            
  63.             </div> <!-- .project-nav -->
  64.  
  65. <?php
  66. get_sidebar();
  67. get_footer();
Add Comment
Please, Sign In to add comment