Advertisement
SRD75

single-disorder.php

Oct 3rd, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.81 KB | None | 0 0
  1. <?php
  2.  
  3. get_header();
  4.  
  5. $show_default_title = get_post_meta( get_the_ID(), '_et_pb_show_title', true );
  6.  
  7. $is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() );
  8.  
  9. $therapies = get_field('relationship_field_name');
  10.  
  11. ?>
  12.  
  13. <div id="main-content">
  14.     <?php
  15.         if ( et_builder_is_product_tour_enabled() ):
  16.             // load fullwidth page in Product Tour mode
  17.             while ( have_posts() ): the_post(); ?>
  18.  
  19.                 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  20.                     <div class="entry-content">
  21.                     <?php
  22.                         the_content();
  23.                     ?>
  24.                     </div> <!-- .entry-content -->
  25.  
  26.                 </article> <!-- .et_pb_post -->
  27.  
  28.         <?php endwhile;
  29.         else:
  30.     ?>
  31.     <div class="container">
  32.         <div id="content-area" class="clearfix">
  33.             <div id="left-area">
  34.             <?php while ( have_posts() ) : the_post(); ?>
  35.                 <?php if (et_get_option('divi_integration_single_top') <> '' && et_get_option('divi_integrate_singletop_enable') == 'on') echo(et_get_option('divi_integration_single_top')); ?>
  36.                 <article id="post-<?php the_ID(); ?>" <?php post_class( 'et_pb_post' ); ?>>
  37.                     <?php if ( ( 'off' !== $show_default_title && $is_page_builder_used ) || ! $is_page_builder_used ) { ?>
  38.                         <div class="et_post_meta_wrapper">
  39.                             <h1 class="entry-title"><?php the_title(); ?></h1>
  40.  
  41.                         <?php
  42.                             if ( ! post_password_required() ) :
  43.  
  44.                                 et_divi_post_meta();
  45.  
  46.                                 $thumb = '';
  47.  
  48.                                 $width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 );
  49.  
  50.                                 $height = (int) apply_filters( 'et_pb_index_blog_image_height', 675 );
  51.                                 $classtext = 'et_featured_image';
  52.                                 $titletext = get_the_title();
  53.                                 $thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Blogimage' );
  54.                                 $thumb = $thumbnail["thumb"];
  55.  
  56.                                 $post_format = et_pb_post_format();
  57.  
  58.                                 if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) {
  59.                                     printf(
  60.                                         '<div class="et_main_video_container">
  61.                                             %1$s
  62.                                         </div>',
  63.                                         $first_video
  64.                                     );
  65.                                 } else if ( ! in_array( $post_format, array( 'gallery', 'link', 'quote' ) ) && 'on' === et_get_option( 'divi_thumbnails', 'on' ) && '' !== $thumb ) {
  66.                                     print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height );
  67.                                 } else if ( 'gallery' === $post_format ) {
  68.                                     et_pb_gallery_images();
  69.                                 }
  70.                             ?>
  71.  
  72.                             <?php
  73.                                 $text_color_class = et_divi_get_post_text_color();
  74.  
  75.                                 $inline_style = et_divi_get_post_bg_inline_style();
  76.  
  77.                                 switch ( $post_format ) {
  78.                                     case 'audio' :
  79.                                         $audio_player = et_pb_get_audio_player();
  80.  
  81.                                         if ( $audio_player ) {
  82.                                             printf(
  83.                                                 '<div class="et_audio_content%1$s"%2$s>
  84.                                                     %3$s
  85.                                                 </div>',
  86.                                                 esc_attr( $text_color_class ),
  87.                                                 $inline_style,
  88.                                                 $audio_player
  89.                                             );
  90.                                         }
  91.  
  92.                                         break;
  93.                                     case 'quote' :
  94.                                         printf(
  95.                                             '<div class="et_quote_content%2$s"%3$s>
  96.                                                 %1$s
  97.                                             </div> <!-- .et_quote_content -->',
  98.                                             et_get_blockquote_in_content(),
  99.                                             esc_attr( $text_color_class ),
  100.                                             $inline_style
  101.                                         );
  102.  
  103.                                         break;
  104.                                     case 'link' :
  105.                                         printf(
  106.                                             '<div class="et_link_content%3$s"%4$s>
  107.                                                 <a href="%1$s" class="et_link_main_url">%2$s</a>
  108.                                             </div> <!-- .et_link_content -->',
  109.                                             esc_url( et_get_link_url() ),
  110.                                             esc_html( et_get_link_url() ),
  111.                                             esc_attr( $text_color_class ),
  112.                                             $inline_style
  113.                                         );
  114.  
  115.                                         break;
  116.                                 }
  117.  
  118.                             endif;
  119.                         ?>
  120.                     </div> <!-- .et_post_meta_wrapper -->
  121.                 <?php  } ?>
  122.  
  123.                     <div class="entry-content">
  124.                     <?php
  125.                         do_action( 'et_before_content' );
  126.  
  127.                         the_content();
  128.                        
  129.                         if( $therapies ) { ?>
  130.                         <h3>Related Therapies</h3>
  131.                         <ul>
  132.                         <?php foreach( $therapies as $t ): // variable must NOT be called $post (IMPORTANT) ?>
  133.                             <li>
  134.                                 <a href="<?php echo get_permalink( $t->ID ); ?>"><?php echo get_the_title( $t->ID ); ?></a>
  135.                                 <span>Custom field from $post: <?php the_field('author', $t->ID); ?></span>
  136.                             </li>
  137.                         <?php endforeach; ?>
  138.                         </ul>
  139.                         <?php } ?>
  140.                         <?php
  141.                         wp_link_pages( array( 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'Divi' ), 'after' => '</div>' ) );
  142.                     ?>
  143.                     </div> <!-- .entry-content -->
  144.                     <div class="et_post_meta_wrapper">
  145.                     <?php
  146.                     if ( et_get_option('divi_468_enable') == 'on' ){
  147.                         echo '<div class="et-single-post-ad">';
  148.                         if ( et_get_option('divi_468_adsense') <> '' ) echo( et_get_option('divi_468_adsense') );
  149.                         else { ?>
  150.                             <a href="<?php echo esc_url(et_get_option('divi_468_url')); ?>"><img src="<?php echo esc_attr(et_get_option('divi_468_image')); ?>" alt="468" class="foursixeight" /></a>
  151.                 <?php   }
  152.                         echo '</div> <!-- .et-single-post-ad -->';
  153.                     }
  154.                 ?>
  155.  
  156.                     <?php if (et_get_option('divi_integration_single_bottom') <> '' && et_get_option('divi_integrate_singlebottom_enable') == 'on') echo(et_get_option('divi_integration_single_bottom')); ?>
  157.  
  158.                     <?php
  159.                         if ( ( comments_open() || get_comments_number() ) && 'on' == et_get_option( 'divi_show_postcomments', 'on' ) ) {
  160.                             comments_template( '', true );
  161.                         }
  162.                     ?>
  163.                     </div> <!-- .et_post_meta_wrapper -->
  164.                 </article> <!-- .et_pb_post -->
  165.  
  166.             <?php endwhile; ?>
  167.             </div> <!-- #left-area -->
  168.  
  169.             <?php get_sidebar(); ?>
  170.         </div> <!-- #content-area -->
  171.     </div> <!-- .container -->
  172.     <?php endif; ?>
  173. </div> <!-- #main-content -->
  174.  
  175. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement