Guest User

Untitled

a guest
Dec 19th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. <?php
  2. /* ----------------------------------------------------------------------------
  3. the default page template
  4. */
  5.  
  6.  
  7. get_header();
  8.  
  9.  
  10. //set the template id, used to get the template specific settings
  11. $template_id = 'page';
  12.  
  13.  
  14. $loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos'); //sidebar right is default (empty)
  15.  
  16. //get theme panel variable for page comments side wide
  17. $td_enable_or_disable_page_comments = td_util::get_option('tds_disable_comments_pages');
  18.  
  19.  
  20. //read the custom single post settings - this setting overids all of them
  21. $td_page = td_util::get_post_meta_array($post->ID, 'td_page');
  22. if (!empty($td_page['td_sidebar_position'])) {
  23. $loop_sidebar_position = $td_page['td_sidebar_position'];
  24. }
  25.  
  26. // sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue
  27. $td_sidebar_position = '';
  28. if($loop_sidebar_position == 'sidebar_left') {
  29. $td_sidebar_position = 'td-sidebar-left';
  30. }
  31.  
  32. // check if buddypress is active
  33. $is_buddypress_template = function_exists( 'is_buddypress' ) ? is_buddypress() : false;
  34.  
  35. /**
  36. * detect the page builder
  37. */
  38. $td_use_page_builder = td_global::is_page_builder_content();
  39.  
  40.  
  41.  
  42.  
  43. if ($td_use_page_builder) {
  44.  
  45. // the page is rendered using the page builder template (no sidebars)
  46. if (have_posts()) { ?>
  47. <?php while ( have_posts() ) : the_post(); ?>
  48.  
  49. <div class="td-main-content-wrap td-main-page-wrap td-container-wrap">
  50. <div class="<?php if (!td_util::tdc_is_installed()) { echo 'td-container '; } ?>tdc-content-wrap">
  51. <?php the_content(); ?>
  52. </div>
  53. <?php
  54. if($td_enable_or_disable_page_comments == 'show_comments') {
  55. ?>
  56. <div class="td-container">
  57. <div class="td-pb-row">
  58. <div class="td-pb-span12">
  59. <?php comments_template('', true); ?>
  60. </div>
  61. </div>
  62. </div>
  63. <?php
  64. }
  65. ?>
  66. </div> <!-- /.td-main-content-wrap -->
  67.  
  68.  
  69. <?php endwhile; ?>
  70. <?php }
  71. } else {
  72.  
  73. //no page builder detected, we load a default page template with sidebar / no sidebar
  74. ?>
  75.  
  76. <div class="td-main-content-wrap td-container-wrap">
  77. <div class="td-container tdc-content-wrap <?php echo $td_sidebar_position; ?>">
  78. <div class="td-crumb-container">
  79. <?php echo td_page_generator::get_page_breadcrumbs(get_the_title()); ?>
  80. </div>
  81. <div class="td-pb-row">
  82. <?php
  83. switch ($loop_sidebar_position) {
  84. default:
  85. ?>
  86. <div class="td-pb-span8 td-main-content" role="main">
  87. <div class="td-ss-main-content">
  88. <?php
  89. if (have_posts()) {
  90. while ( have_posts() ) : the_post();
  91. ?>
  92. <div class="td-page-header">
  93. <h1 class="entry-title td-page-title">
  94. <span><?php the_title() ?></span>
  95. </h1>
  96. </div>
  97. <div class="td-page-content">
  98. <?php
  99. the_content();
  100. endwhile;//end loop
  101.  
  102. }
  103. ?>
  104. </div>
  105. <?php
  106.  
  107. //Display comments when we are not on buddypress template; when buddypress is true do nothing
  108. if ($is_buddypress_template === false) {
  109. if($td_enable_or_disable_page_comments == 'show_comments') {
  110. comments_template('', true);
  111. }
  112. } ?>
  113. </div>
  114. </div>
  115. <div class="td-pb-span4 td-main-sidebar" role="complementary">
  116. <div class="td-ss-main-sidebar">
  117. <?php get_sidebar(); ?>
  118. </div>
  119. </div>
  120. <?php
  121. break;
  122.  
  123. case 'sidebar_left':
  124. ?>
  125. <div class="td-pb-span8 td-main-content <?php echo $td_sidebar_position; ?>-content" role="main">
  126. <div class="td-ss-main-content">
  127. <?php
  128.  
  129. if (have_posts()) {
  130. while ( have_posts() ) : the_post();
  131. ?>
  132. <div class="td-page-header">
  133. <h1 class="entry-title td-page-title">
  134. <span><?php the_title() ?></span>
  135. </h1>
  136. </div>
  137. <div class="td-page-content">
  138. <?php
  139. the_content();
  140. endwhile; //end loop
  141. }
  142. ?>
  143. </div>
  144. <?php
  145. if ($is_buddypress_template === false) {
  146. if($td_enable_or_disable_page_comments == 'show_comments') {
  147. comments_template('', true);
  148. }
  149. }?>
  150.  
  151. </div>
  152. </div>
  153. <div class="td-pb-span4 td-main-sidebar" role="complementary">
  154. <div class="td-ss-main-sidebar">
  155. <?php get_sidebar(); ?>
  156. </div>
  157. </div>
  158. <?php
  159. break;
  160.  
  161. case 'no_sidebar':
  162. ?>
  163. <div class="td-pb-span12 td-main-content" role="main">
  164.  
  165. <?php
  166. if (have_posts()) {
  167. while ( have_posts() ) : the_post();
  168. ?>
  169. <div class="td-page-header">
  170. <h1 class="entry-title td-page-title">
  171. <span><?php the_title() ?></span>
  172. </h1>
  173. </div>
  174. <div class="td-page-content">
  175. <?php
  176. the_content();
  177. endwhile; //end loop
  178. }
  179. ?>
  180. </div>
  181. <?php
  182. if ($is_buddypress_template === false) {
  183. if($td_enable_or_disable_page_comments == 'show_comments') {
  184. comments_template('', true);
  185. }
  186. }?>
  187. </div>
  188. <?php
  189. break;
  190. }
  191. ?>
  192. </div> <!-- /.td-pb-row -->
  193. </div> <!-- /.td-container -->
  194. </div> <!-- /.td-main-content-wrap -->
  195.  
  196. <?php
  197. }
  198.  
  199.  
  200.  
  201.  
  202. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment