Advertisement
SRD75

single-disorder.php

Nov 2nd, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.27 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 WordPress
  8.  * @subpackage Twenty_Seventeen
  9.  * @since 1.0
  10.  * @version 1.0
  11.  */
  12.  
  13. get_header();
  14.  
  15. /* Customization Starts Here */
  16.  
  17. $therapies = get_field('therapies',get_the_ID());
  18.  
  19. /* Customization End Here, continued further down */
  20.  
  21. ?>
  22.  
  23. <div class="wrap">
  24.     <div id="primary" class="content-area">
  25.         <main id="main" class="site-main" role="main">
  26.  
  27.             <?php
  28.             /* Start the Loop */
  29.             while ( have_posts() ) : the_post();
  30.  
  31.                 get_template_part( 'template-parts/post/content', get_post_format() );
  32.                
  33.                 /* Customization Starts Here */            
  34.                
  35.                 if( $therapies ) { ?>
  36.                     <h3>Related Therapies</h3>
  37.                     <ul>
  38.                     <?php foreach( $therapies as $t ): // variable must NOT be called $post (IMPORTANT) ?>
  39.                         <li>
  40.                             <a href="<?php echo get_permalink( $t->ID ); ?>"><?php echo get_the_title( $t->ID ); ?></a>
  41.                             <span>Custom field from $post: <?php the_field('author', $t->ID); ?></span>
  42.                         </li>
  43.                     <?php endforeach; ?>
  44.                     </ul>
  45.                 <?php }            
  46.                
  47.                 /* Customization End Here */               
  48.  
  49.                 // If comments are open or we have at least one comment, load up the comment template.
  50.                 if ( comments_open() || get_comments_number() ) :
  51.                     comments_template();
  52.                 endif;
  53.  
  54.                 the_post_navigation( array(
  55.                     'prev_text' => '<span class="screen-reader-text">' . __( 'Previous Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Previous', 'twentyseventeen' ) . '</span> <span class="nav-title"><span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '</span>%title</span>',
  56.                     'next_text' => '<span class="screen-reader-text">' . __( 'Next Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Next', 'twentyseventeen' ) . '</span> <span class="nav-title">%title<span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '</span></span>',
  57.                 ) );
  58.  
  59.             endwhile; // End of the loop.
  60.             ?>
  61.  
  62.         </main><!-- #main -->
  63.     </div><!-- #primary -->
  64.     <?php get_sidebar(); ?>
  65. </div><!-- .wrap -->
  66.  
  67. <?php get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement