Guest User

Untitled

a guest
Oct 14th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. <?php
  2. global $loop_module_id, $loop_sidebar_position, $post;
  3.  
  4.  
  5. td_global::load_single_post($post);
  6.  
  7.  
  8. /* ----------------------------------------------------------------------------
  9. the post template (single article template)
  10. */
  11.  
  12. get_header();
  13.  
  14.  
  15. /* used by
  16. /includes/app/modules/module_modifier/td_module_blog.php
  17. /sidebar.php
  18. */
  19.  
  20.  
  21.  
  22. //set the template id, used to get the template specific settings
  23. $template_id = 'home'; //home = blog index = blog - use the same settings from the blog index
  24.  
  25. //prepare the loop variables
  26.  
  27. //read the global settings
  28. $loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos'); //sidebar right is default (empty)
  29. $loop_module_id = 1; //use the default 1 module (full post)
  30.  
  31.  
  32.  
  33. //print_r($td_post_theme_settings);
  34.  
  35. //read the primary category sidebar position! - we have to make the page after the primary category or after the global setting
  36. $primary_category_id = td_global::get_primary_category_id();
  37. if (!empty($primary_category_id)) {
  38. $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');
  39. if (!empty($tax_meta_sidebar)) {
  40. //update the sidebar position from the category setting
  41. $loop_sidebar_position = $tax_meta_sidebar;
  42. }
  43. }
  44.  
  45.  
  46. //read the custom single post settings - this setting overids all of them
  47. $td_post_theme_settings = get_post_meta($post->ID, 'td_post_theme_settings', true);
  48. if (!empty($td_post_theme_settings['td_sidebar_position'])) {
  49. $loop_sidebar_position = $td_post_theme_settings['td_sidebar_position'];
  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.  
  68. if (empty($td_post_theme_settings['td_post_template'])) {
  69. // the default single template
  70.  
  71. // we check the sidebar position and for each one we have a different case
  72. switch ($loop_sidebar_position) {
  73.  
  74.  
  75. default: // sidebar right - the default sidebar position
  76. echo td_page_generator::wrap_start();
  77. ?>
  78. <div class="span8 column_container td-post-content" role="main" itemprop="mainContentOfPage">
  79. <?php
  80. locate_template('loop-single.php', true);
  81.  
  82. ?>
  83. </div>
  84. <div class="span4 column_container td-post-sidebar" role="complementary" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/WPSideBar">
  85. <?php get_sidebar(); ?>
  86. </div>
  87. <?php
  88. echo td_page_generator::wrap_end();
  89. break;
  90.  
  91.  
  92. case 'sidebar_left':
  93. echo td_page_generator::wrap_start();
  94. ?>
  95. <div class="span4 column_container td-post-sidebar" role="complementary" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https?>://schema.org/WPSideBar">
  96. <?php get_sidebar(); ?>
  97. </div>
  98. <div class="span8 column_container td-post-content" role="main" itemprop="mainContentOfPage">
  99. <?php
  100. locate_template('loop-single.php', true);
  101.  
  102. ?>
  103. </div>
  104. <?php
  105. echo td_page_generator::wrap_end();
  106. break;
  107.  
  108. case 'no_sidebar':
  109. //td_global::$load_featured_img_from_template = 'art-slide-big';
  110. td_global::$load_featured_img_from_template = 'full';
  111. echo td_page_generator::wrap_start();
  112. ?>
  113. <div class="span12 column_container td-post-content" role="main" itemprop="mainContentOfPage">
  114. <?php
  115. locate_template('loop-single.php', true);
  116.  
  117. ?>
  118. </div>
  119. <?php
  120. echo td_page_generator::wrap_end();
  121. break;
  122.  
  123.  
  124.  
  125.  
  126. }
  127.  
  128. } else {
  129. //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
  130. if (array_key_exists ($td_post_theme_settings['td_post_template'], td_global::$post_templates_list)) {
  131. locate_template($td_post_theme_settings['td_post_template'] . '.php', true);
  132. }
  133. }
  134. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment