Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class td_category_template_8 extends td_category_template
- {
- function render()
- {
- ?>
- <!-- subcategory -->
- <div class="td-category-header td-image-gradient-style8">
- <div class="td-container">
- <div class="td-crumb-container"><?php echo parent::get_breadcrumbs(); ?></div>
- <div class="td-category-title-holder">
- <h1 itemprop="name" class="entry-title td-page-title"><?php echo parent::get_title(); ?></h1>
- <?php
- echo $this->get_sibling_categories(); ?>
- <?php echo parent::get_description(); ?>
- </div>
- <?php echo parent::get_pull_down(); ?>
- </div>
- </div>
- <?php
- }
- protected function get_sibling_categories($params_array = '') {
- $buffy = '';
- $current_category_id = td_global::$current_category_obj->cat_ID;
- $current_category_obj = td_global::$current_category_obj;
- $current_category_link = get_category_link($current_category_id);
- //the subcategories
- if (!empty($current_category_obj->cat_ID)) {
- if ($current_category_obj->parent === 0) {
- // get child categories
- $categories_objects = get_categories( array(
- 'parent' => $current_category_obj->cat_ID,
- 'hide_empty' => 0,
- 'number' => parent::SIBLING_CATEGORY_LIMIT
- ) );
- }
- // if no child categories get siblings
- }
- /**
- * if we have categories to show... show them
- */
- if (!empty($categories_objects)) {
- $buffy = '<div class="td-category-siblings">';
- $buffy .= '<ul class="td-category">';
- foreach ($categories_objects as $category_object) {
- // ignore featured cat and uncategorized
- if (($category_object->name == TD_FEATURED_CAT) OR
- (strtolower($category_object->cat_name) == 'uncategorized')) {
- continue;
- }
- if (!empty($category_object->name) and td_util::get_category_option($category_object->cat_ID,'tdc_hide_on_post') != 'hide') {
- $class = '';
- if($category_object->cat_ID == $current_category_id) {
- $class = 'td-current-sub-category';
- }
- $td_css_inline = new td_css_inline();
- // @todo we can add more properties as needed, ex: show_border_color
- if (!empty($params_array['show_background_color'])) {
- $tdc_color_current_cat = td_util::get_category_option($category_object->cat_ID, 'tdc_color');
- $td_css_inline->add_css (
- array(
- 'background-color' => $tdc_color_current_cat
- )
- );
- }
- $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>';
- }
- }
- $buffy .= '</ul>';
- // subcategory dropdown list
- $buffy .= '<div class="td-subcat-dropdown td-pulldown-filter-display-option">';
- $buffy .= '<div class="td-subcat-more"><i class="td-icon-menu-down"></i></div>';
- // the dropdown list
- $buffy .= '<ul class="td-pulldown-filter-list">';
- $buffy .= '</ul>';
- $buffy .= '</div>';
- $buffy .= '<div class="clearfix"></div>';
- $buffy .= '</div>';
- }
- // compile the custom css
- if (!empty($params_array['current_category_css'])) {
- $tdc_color = td_util::get_category_option($current_category_obj->cat_ID, 'tdc_color');
- $td_css_compiler = new td_css_compiler($params_array['current_category_css']);
- $td_css_compiler->load_setting_raw('current_category_color', $tdc_color);
- td_css_buffer::add_to_footer($td_css_compiler->compile_css());
- }
- return $buffy;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment