Advertisement
SRD75

single-disorder.php

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