Guest User

Untitled

a guest
Mar 16th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.06 KB | None | 0 0
  1. <?php
  2. /* Template Name: Pagebuilder + page title */
  3.  
  4. /**
  5. * This template supports the pagebuilde + optional sidebar, this means that it has to adjusts it's columns on the fly
  6. * @see td_util::vc_get_column_number - that function is used by our blocks to detect the column count, on this template it's altered
  7. */
  8. get_header();
  9.  
  10. td_global::$current_template = 'page-title-sidebar';
  11. //set the template id, used to get the template specific settings
  12. $template_id = 'page';
  13.  
  14.  
  15. $loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos'); //sidebar right is default (empty)
  16. $td_enable_or_disable_page_comments = td_util::get_option('tds_disable_comments_pages');
  17.  
  18.  
  19. //read the custom single post settings - this setting overids all of them
  20. $td_page = get_post_meta($post->ID, 'td_page', true);
  21. if (!empty($td_page['td_sidebar_position'])) {
  22. $loop_sidebar_position = $td_page['td_sidebar_position'];
  23. }
  24.  
  25.  
  26. /**
  27. * detect the page builder
  28. */
  29. $td_use_page_builder = false;
  30. if (method_exists('WPBMap', 'getShortCodes')) {
  31. $td_page_builder_short_codes = array_keys(WPBMap::getShortCodes());
  32. if (td_util::strpos_array($post->post_content, $td_page_builder_short_codes) === true) {
  33. $td_use_page_builder = true;
  34. }
  35. }
  36.  
  37.  
  38.  
  39.  
  40. //no page builder detected, we load a default page template with sidebar / no sidebar
  41. ?>
  42. <div class="td-container">
  43. <div class="td-container-border">
  44. <div class="td-pb-row">
  45. <?php
  46. switch ($loop_sidebar_position) {
  47. default:
  48. ?>
  49. <div class="td-pb-span8 td-main-content" role="main">
  50. <div class="td-ss-main-content">
  51. <?php
  52. if (have_posts()) {
  53. while ( have_posts() ) : the_post();
  54. ?>
  55. <div class="td-page-header td-pb-padding-side">
  56. <?php echo td_page_generator::get_page_breadcrumbs(get_the_title()); ?>
  57. <h1 class="entry-title td-page-title">
  58. <span><?php the_title() ?></span>
  59. </h1>
  60. </div>
  61. <div class="td-pb-padding-side td-page-content">
  62. <?php
  63. the_content();
  64. endwhile;//end loop
  65. }
  66. ?>
  67. </div>
  68. <?php
  69. if($td_enable_or_disable_page_comments == 'show_comments') {
  70. comments_template('', true);
  71. }?>
  72. </div>
  73. </div>
  74. <div class="td-pb-span4 td-main-sidebar" role="complementary">
  75. <div class="td-ss-main-sidebar">
  76. <?php get_sidebar(); ?>
  77. </div>
  78. </div>
  79. <?php
  80. break;
  81.  
  82. case 'sidebar_left':
  83. ?>
  84. <div class="td-pb-span4 td-main-sidebar" role="complementary">
  85. <div class="td-ss-main-sidebar">
  86. <?php get_sidebar(); ?>
  87. </div>
  88. </div>
  89. <div class="td-pb-span8 td-main-content" role="main">
  90. <div class="td-ss-main-content">
  91. <?php
  92.  
  93. if (have_posts()) {
  94. while ( have_posts() ) : the_post();
  95. ?>
  96. <div class="td-page-header td-pb-padding-side">
  97. <?php echo td_page_generator::get_page_breadcrumbs(get_the_title()); ?>
  98. <h1 class="entry-title td-page-title">
  99. <span><?php the_title() ?></span>
  100. </h1>
  101. </div>
  102. <div class="td-pb-padding-side td-page-content">
  103. <?php
  104. the_content();
  105. endwhile; //end loop
  106. }
  107. ?>
  108. </div>
  109. </div>
  110. <?php
  111. if($td_enable_or_disable_page_comments == 'show_comments') {
  112. comments_template('', true);
  113. }?>
  114. </div>
  115. <?php
  116. break;
  117.  
  118. case 'no_sidebar':
  119. ?>
  120. <div class="td-pb-span12 td-main-content" role="main">
  121. <div class="td-ss-main-content">
  122. <?php
  123. if (have_posts()) {
  124. while ( have_posts() ) : the_post();
  125. ?>
  126. <div class="td-page-header td-pb-padding-side">
  127. <?php echo td_page_generator::get_page_breadcrumbs(get_the_title()); ?>
  128. <h1 class="entry-title td-page-title">
  129. <?php /*<a itemprop="url" href="<?php the_permalink()?>" rel="bookmark" title="<?php the_title_attribute() ?>"><?php the_title() ?></a>*/?>
  130. <span><?php the_title() ?></span>
  131. </h1>
  132. </div>
  133. <div class="td-pb-padding-side td-page-content">
  134. <?php
  135. the_content();
  136. endwhile; //end loop
  137. }
  138. ?>
  139. </div>
  140. <?php
  141. if($td_enable_or_disable_page_comments == 'show_comments') {
  142. comments_template('', true);
  143. }?>
  144. </div>
  145. </div>
  146. <?php
  147. break;
  148. }
  149. ?>
  150. </div> <!-- /.td-pb-row -->
  151. </div>
  152. </div> <!-- /.td-container -->
  153.  
  154. <?php
  155.  
  156.  
  157.  
  158.  
  159. get_footer();
  160. ?>
Advertisement
Add Comment
Please, Sign In to add comment