Guest User

Untitled

a guest
Jun 23rd, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. <?php
  2. class td_category_template_8 extends td_category_template
  3. {
  4.  
  5. function render()
  6. {
  7. ?>
  8.  
  9. <!-- subcategory -->
  10. <div class="td-category-header td-image-gradient-style8">
  11. <div class="td-container">
  12. <div class="td-crumb-container"><?php echo parent::get_breadcrumbs(); ?></div>
  13. <div class="td-category-title-holder">
  14.  
  15. <h1 itemprop="name" class="entry-title td-page-title"><?php echo parent::get_title(); ?></h1>
  16. <?php
  17.  
  18. echo $this->get_sibling_categories(); ?>
  19. <?php echo parent::get_description(); ?>
  20.  
  21. </div>
  22. <?php echo parent::get_pull_down(); ?>
  23. </div>
  24. </div>
  25.  
  26. <?php
  27. }
  28. protected function get_sibling_categories($params_array = '') {
  29. $buffy = '';
  30.  
  31. $current_category_id = td_global::$current_category_obj->cat_ID;
  32. $current_category_obj = td_global::$current_category_obj;
  33. $current_category_link = get_category_link($current_category_id);
  34.  
  35. //the subcategories
  36. if (!empty($current_category_obj->cat_ID)) {
  37.  
  38. if ($current_category_obj->parent === 0) {
  39.  
  40. // get child categories
  41. $categories_objects = get_categories( array(
  42. 'parent' => $current_category_obj->cat_ID,
  43. 'hide_empty' => 0,
  44. 'number' => parent::SIBLING_CATEGORY_LIMIT
  45. ) );
  46. }
  47.  
  48. // if no child categories get siblings
  49.  
  50. }
  51.  
  52.  
  53. /**
  54. * if we have categories to show... show them
  55. */
  56. if (!empty($categories_objects)) {
  57. $buffy = '<div class="td-category-siblings">';
  58. $buffy .= '<ul class="td-category">';
  59. foreach ($categories_objects as $category_object) {
  60.  
  61. // ignore featured cat and uncategorized
  62. if (($category_object->name == TD_FEATURED_CAT) OR
  63. (strtolower($category_object->cat_name) == 'uncategorized')) {
  64. continue;
  65. }
  66.  
  67. if (!empty($category_object->name) and td_util::get_category_option($category_object->cat_ID,'tdc_hide_on_post') != 'hide') {
  68. $class = '';
  69. if($category_object->cat_ID == $current_category_id) {
  70. $class = 'td-current-sub-category';
  71. }
  72.  
  73.  
  74. $td_css_inline = new td_css_inline();
  75.  
  76. // @todo we can add more properties as needed, ex: show_border_color
  77. if (!empty($params_array['show_background_color'])) {
  78. $tdc_color_current_cat = td_util::get_category_option($category_object->cat_ID, 'tdc_color');
  79. $td_css_inline->add_css (
  80. array(
  81. 'background-color' => $tdc_color_current_cat
  82. )
  83. );
  84. }
  85.  
  86.  
  87. $buffy .= '<li class="entry-category"><a ' . $td_css_inline->get_inline_css() . ' class="' . $class . '" href="' . get_category_link($category_object->cat_ID) . '">' . $category_object->name . '</a></li>';
  88. }
  89. }
  90. $buffy .= '</ul>';
  91.  
  92.  
  93. // subcategory dropdown list
  94. $buffy .= '<div class="td-subcat-dropdown td-pulldown-filter-display-option">';
  95. $buffy .= '<div class="td-subcat-more"><i class="td-icon-menu-down"></i></div>';
  96.  
  97. // the dropdown list
  98. $buffy .= '<ul class="td-pulldown-filter-list">';
  99. $buffy .= '</ul>';
  100.  
  101. $buffy .= '</div>';
  102.  
  103. $buffy .= '<div class="clearfix"></div>';
  104.  
  105. $buffy .= '</div>';
  106. }
  107.  
  108.  
  109. // compile the custom css
  110. if (!empty($params_array['current_category_css'])) {
  111. $tdc_color = td_util::get_category_option($current_category_obj->cat_ID, 'tdc_color');
  112.  
  113. $td_css_compiler = new td_css_compiler($params_array['current_category_css']);
  114. $td_css_compiler->load_setting_raw('current_category_color', $tdc_color);
  115. td_css_buffer::add_to_footer($td_css_compiler->compile_css());
  116. }
  117.  
  118.  
  119. return $buffy;
  120. }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment