Guest User

Untitled

a guest
Mar 16th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.16 KB | None | 0 0
  1. <?php
  2. // Default template - post-final-default.psd
  3.  
  4. global $loop_module_id, $loop_sidebar_position, $post;
  5.  
  6.  
  7.  
  8. //global $wp_query;
  9. //var_dump($wp_query->query_vars);
  10.  
  11. td_global::load_single_post($post);
  12.  
  13.  
  14. /* ----------------------------------------------------------------------------
  15. the post template (single article template)
  16. */
  17.  
  18. get_header();
  19.  
  20.  
  21. //set the template id, used to get the template specific settings
  22. $template_id = 'home'; //home = blog index = blog - use the same settings from the blog index
  23.  
  24. //prepare the loop variables
  25.  
  26. //read the global settings
  27. $loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos'); //sidebar right is default (empty)
  28. $loop_module_id = 1; //use the default 1 module (full post)
  29.  
  30. //read the primary category sidebar position! - we have to make the page after the primary category or after the global setting
  31. $primary_category_id = td_global::get_primary_category_id();
  32. if (!empty($primary_category_id)) {
  33. $tax_meta_sidebar = td_util::get_category_option($primary_category_id, 'tdc_sidebar_pos');//swich by RADU A, get_tax_meta($primary_category_id, 'tdc_sidebar_pos');
  34. if (!empty($tax_meta_sidebar)) {
  35. //update the sidebar position from the category setting
  36. $loop_sidebar_position = $tax_meta_sidebar;
  37. }
  38. }
  39.  
  40.  
  41. //read the custom single post settings - this setting overids all of them
  42. $td_post_theme_settings = get_post_meta($post->ID, 'td_post_theme_settings', true);
  43. if (!empty($td_post_theme_settings['td_sidebar_position'])) {
  44. $loop_sidebar_position = $td_post_theme_settings['td_sidebar_position'];
  45. }
  46.  
  47. //set the content width if needed (we already have the default in functions)
  48. if ($loop_sidebar_position == 'no_sidebar') {
  49. $content_width = 980;
  50. }
  51.  
  52. //send the sidebar position to gallery
  53. td_global::$cur_single_template_sidebar_pos = $loop_sidebar_position;
  54.  
  55. //increment the views counter
  56. td_page_views::update_page_views($post->ID);
  57.  
  58.  
  59. //added by Radu A. check if this post have a post template to be display with.
  60. //if not use the default site post template from Theme Panel -> Post Settings -> Default site post template
  61. $td_default_site_post_template = td_util::get_option('td_default_site_post_template');
  62.  
  63. if(empty($td_post_theme_settings['td_post_template']) and !empty($td_default_site_post_template)) {
  64. $td_post_theme_settings['td_post_template'] = $td_default_site_post_template;
  65. }
  66.  
  67. if (empty($td_post_theme_settings['td_post_template'])) {
  68. ?>
  69.  
  70. <div class="td-container td-post-template-default">
  71. <div class="td-container-border">
  72. <div class="td-pb-row">
  73. <?php
  74.  
  75. //the default template
  76. switch ($loop_sidebar_position) {
  77. default: //sidebar right
  78. ?>
  79. <div class="td-pb-span8 td-main-content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/Blog">
  80. <div class="td-ss-main-content">
  81. <?php
  82. locate_template('loop-single.php', true);
  83. comments_template('', true);
  84. ?>
  85. </div>
  86. </div>
  87. <div class="td-pb-span4 td-main-sidebar" role="complementary" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/WPSideBar">
  88. <div class="td-ss-main-sidebar">
  89. <?php get_sidebar(); ?>
  90. </div>
  91. </div>
  92. <?php
  93. break;
  94.  
  95. case 'sidebar_left':
  96. ?>
  97. <div class="td-pb-span4 td-main-sidebar" role="complementary" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/WPSideBar">
  98. <div class="td-ss-main-sidebar">
  99. <?php get_sidebar(); ?>
  100. </div>
  101. </div>
  102. <div class="td-pb-span8 td-main-content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/Blog">
  103. <div class="td-ss-main-content">
  104. <?php
  105. locate_template('loop-single.php', true);
  106. comments_template('', true);
  107. ?>
  108. </div>
  109. </div>
  110. <?php
  111. break;
  112.  
  113. case 'no_sidebar':
  114. //td_global::$load_featured_img_from_template = 'art-slide-big';
  115. td_global::$load_featured_img_from_template = 'full';
  116. ?>
  117. <div class="td-pb-span12 td-main-content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/Blog">
  118. <div class="td-ss-main-content">
  119. <?php
  120. locate_template('loop-single.php', true);
  121. comments_template('', true);
  122. ?>
  123. </div>
  124. </div>
  125. <?php
  126. break;
  127.  
  128. }
  129. ?>
  130. </div> <!-- /.td-pb-row -->
  131. </div>
  132. </div> <!-- /.td-container -->
  133.  
  134. <?php
  135.  
  136. } else {
  137. //the user has selected a different template & we make sure we only load our templates - the list of allowed templates is in includes/wp_booster/td_global.php
  138. td_api_single_template::_helper_show_single_template($td_post_theme_settings['td_post_template']);
  139.  
  140. }
  141. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment