Example #1
2
 function render($atts)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     extract(shortcode_atts(array('limit' => 3, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'show_child_cat' => '', 'tag_slug' => '', 'header_color' => ''), $atts));
     $buffy = '';
     //output buffer
     $td_unique_id = td_global::td_generate_unique_id();
     $td_query =& td_data_source::get_wp_query($atts);
     //by ref  do the query
     //get the js for this block
     $buffy .= $this->get_block_js($atts, $td_query);
     $buffy .= '<div class="td_block_wrap td_block7">';
     //get the block title
     $buffy .= $this->get_block_title($atts);
     //get the sub category filter for this block
     $buffy .= $this->get_block_sub_cats($atts, $td_unique_id);
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     //inner content of the block
     $buffy .= $this->inner($td_query->posts);
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination($atts, $td_unique_id);
     $buffy .= '</div> <!-- ./block1 -->';
     return $buffy;
 }
Example #2
0
 /**
  * renders the filter of the block
  * @return string
  */
 function get_pull_down_filter()
 {
     $buffy = '';
     if (empty($this->template_data_array['td_pull_down_items'])) {
         return '';
     }
     //generate unique id for this pull down filter control
     $pull_down_wrapper_id = "td_pulldown_" . $this->template_data_array['block_uid'];
     // wrapper
     $buffy .= '<div class="td-subcat-filter" id="' . $pull_down_wrapper_id . '">';
     // subcategory list
     $buffy .= '<ul class="td-subcat-list" id="' . $pull_down_wrapper_id . '_list">';
     foreach ($this->template_data_array['td_pull_down_items'] as $item) {
         $buffy .= '<li class="td-subcat-item"><a class="td-subcat-link" id="' . td_global::td_generate_unique_id() . '" data-td_filter_value="' . $item['id'] . '" data-td_block_id="' . $this->template_data_array['block_uid'] . '" href="#">' . $item['name'] . '</a></li>';
     }
     $buffy .= '</ul>';
     // subcategory dropdown list
     $buffy .= '<div class="td-subcat-dropdown">';
     $buffy .= '<div class="td-subcat-more" aria-haspopup="true"><span>' . __td('More', TD_THEME_NAME) . '</span><i class="td-icon-read-down"></i></div>';
     // the dropdown list
     $buffy .= '<ul class="td-pulldown-filter-list">';
     $buffy .= '</ul>';
     $buffy .= '</div>';
     $buffy .= '</div>';
     return $buffy;
 }
function td_theme_settings_read_for_demo()
{
    $td_cookie_value = '';
    if (isset($_COOKIE["td-cookie-demo-theme-options"])) {
        $td_cookie_value = $_COOKIE["td-cookie-demo-theme-options"];
    }
    switch ($td_cookie_value) {
        case 'style_1':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_1.txt', true)));
            break;
        case 'style_2':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_2.txt', true)));
            break;
        case 'style_3':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_3.txt', true)));
            break;
        case 'style_4':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_4.txt', true)));
            break;
            //read the database theme options if no cookie is found
        //read the database theme options if no cookie is found
        default:
            td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
    }
}
 /**
  * we have to render the block first in the buffer, to avoid two queries.
  * - IF there are posts, we already have the buffer with the block's content and we don't have to make another query
  * - IF there are no posts, we ignore the buffer and we can also remove the wraps in the child classes of this class
  */
 protected function render_posts_to_buffer()
 {
     // get the global category top posts grid style setting
     $td_grid_style = td_util::get_option('tds_category_td_grid_style');
     $limit = td_api_category_top_posts_style::_helper_get_posts_shown_in_the_loop();
     $block_name = td_api_category_top_posts_style::get_key(get_class($this), 'td_block_name');
     // overwrite the $td_grid_style if the setting for this category was changed
     $td_grid_style_per_category_setting = td_util::get_category_option(td_global::$current_category_obj->cat_ID, 'tdc_category_td_grid_style');
     if ($td_grid_style_per_category_setting != '') {
         $td_grid_style = $td_grid_style_per_category_setting;
     }
     // we have to have a default grid, there seems to be a problem with the grid styles
     if (empty($td_grid_style)) {
         $td_grid_style = 'td-grid-style-1';
     }
     //parameters to filter to for big grid
     $atts_for_big_grid = array('limit' => $limit, 'category_id' => td_global::$current_category_obj->cat_ID, 'sort' => get_query_var('filter_by'), 'td_grid_style' => $td_grid_style);
     //show the big grid
     $block_instance = td_global_blocks::get_instance($block_name);
     $this->rendered_block_buffer = $block_instance->render($atts_for_big_grid);
     $this->rendered_posts_count = $block_instance->td_query->post_count;
     if ($this->rendered_posts_count > 0) {
         td_global::$custom_no_posts_message = false;
     }
     // use class_name($this) to get the id :)
 }
 function render($atts, $content = null)
 {
     parent::render($atts);
     // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
     // we have no related posts to display
     if ($this->td_query->post_count == 0) {
         return;
     }
     $buffy = '';
     //output buffer
     //get the js for this block
     $buffy .= $this->get_block_js();
     $buffy .= '<div class="' . $this->get_block_classes() . '">';
     //get the filter for this block
     $buffy .= '<h4 class="td-related-title">';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-left td-cur-simple-item" data-td_filter_value="" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('RELATED ARTICLES') . '</a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_related_more_from_author" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('MORE FROM AUTHOR') . '</a>';
     $buffy .= '</h4>';
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     $buffy .= $this->inner($this->td_query->posts);
     //inner content of the block
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination();
     $buffy .= '</div> <!-- ./block -->';
     return $buffy;
 }
 function render($atts, $content = null)
 {
     $atts['limit'] = 5;
     parent::render($atts);
     // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
     if (is_category()) {
         // we have no related posts to display
         if ($this->td_query->post_count == 0) {
             return '<div class="td_line_above_cat_big_grid"> </div>';
         }
         /** if we have posts in the big grid and we are on a category, do not show the default page no posts message. @see td_global::$custom_no_posts_message */
         td_global::$custom_no_posts_message = false;
     }
     $buffy = '';
     //output buffer
     //get the js for this block
     $buffy .= $this->get_block_js();
     $buffy .= '<div class="' . $this->get_block_classes() . '">';
     //get the block title
     $buffy .= $this->get_block_title();
     //get the sub category filter for this block
     $buffy .= $this->get_pull_down_filter();
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     $buffy .= $this->inner($this->td_query->posts);
     //inner content of the block
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination();
     $buffy .= '</div> <!-- ./block -->';
     $buffy .= '<div class="clearfix"></div>';
     return $buffy;
 }
 /**
  * @todo mega menu subcats - folosim functia asta pentru ca e necesar sa avem alt output
  * @return bool|string
  */
 function get_pull_down_filter()
 {
     extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'show_child_cat' => '', 'sub_cat_ajax' => ''), $this->atts));
     $buffy = '';
     if (!empty($show_child_cat) and !empty($category_id)) {
         $td_subcategories = get_categories(array('child_of' => $category_id));
         if (!empty($td_subcategories)) {
             if ($show_child_cat != 'all') {
                 $td_subcategories = array_slice($td_subcategories, 0, $show_child_cat);
             }
             $buffy .= '<div class="block-mega-child-cats">';
             //show all categories only on ajax
             if (empty($sub_cat_ajax)) {
                 $buffy .= '<a class="cur-sub-cat mega-menu-sub-cat-' . $this->block_uid . '" id="' . td_global::td_generate_unique_id() . '" data-td_block_id="' . $this->block_uid . '" data-td_filter_value="" href="' . get_category_link($category_id) . '">' . __td('All') . '</a>';
             }
             foreach ($td_subcategories as $td_category) {
                 $buffy .= '<a class="mega-menu-sub-cat-' . $this->block_uid . '"  id="' . td_global::td_generate_unique_id() . '" data-td_block_id="' . $this->block_uid . '" data-td_filter_value="' . $td_category->cat_ID . '" href="' . get_category_link($td_category->cat_ID) . '">' . $td_category->name . '</a>';
             }
             $buffy .= '</div>';
         } else {
             //there are no subcategories, return false - this is used by the mega menu block to alter it's structure
             return false;
         }
     }
     return $buffy;
 }
Example #8
0
 function render($atts)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     extract(shortcode_atts(array('limit' => '6', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'header_color' => ''), $atts));
     $cat_args = array('show_count' => true, 'orderby' => 'count', 'hide_empty' => false, 'order' => 'DESC', 'number' => $limit, 'exclude' => get_cat_ID(TD_FEATURED_CAT));
     if (TD_DEPLOY_MODE == 'demo' or TD_DEPLOY_MODE == 'dev') {
         $cat_args['exclude'] = '251, 252, 253, 254, 255, 256, 257, 258, 305, 306, ' . get_cat_ID(TD_FEATURED_CAT);
     }
     $categories = get_categories($cat_args);
     $buffy = '';
     $buffy .= '<div class="td_block_wrap td_popular_categories widget widget_categories">';
     $buffy .= $this->get_block_title_raw($atts, 'Popular category');
     if (!empty($categories)) {
         $buffy .= '<ul>';
         foreach ($categories as $category) {
             if (strtolower($category->cat_name) != 'uncategorized') {
                 $buffy .= '<li><a href="' . get_category_link($category->cat_ID) . '">' . $category->name . '<span class="td-cat-no">' . $category->count . '</span></a></li>';
             }
         }
         $buffy .= '</ul>';
     }
     $buffy .= '</div> <!-- ./block -->';
     return $buffy;
 }
 function render($atts, $content = null)
 {
     parent::render($atts);
     // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
     // this block need td_column_number to add rows if more posts are displayed on a post.
     /// the td_column_number is not standard here, it's    5 for full width / 3 for content + sidebar
     extract(shortcode_atts(array('td_column_number' => ''), $atts));
     // we have no related posts to display
     if ($this->td_query->post_count == 0) {
         return;
     }
     $buffy = '';
     //output buffer
     //get the js for this block
     $buffy .= $this->get_block_js();
     $buffy .= '<div class="' . $this->get_block_classes() . '">';
     //get the filter for this block
     $buffy .= '<h4 class="td-related-title">';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-left td-cur-simple-item" data-td_filter_value="" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('RELATED ARTICLES', TD_THEME_NAME) . '</a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_related_more_from_author" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('MORE FROM AUTHOR', TD_THEME_NAME) . '</a>';
     $buffy .= '</h4>';
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     $buffy .= $this->inner($this->td_query->posts, $td_column_number);
     //inner content of the block
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination();
     $buffy .= '</div> <!-- ./block -->';
     return $buffy;
 }
 /**
  * get the single breadcrumbs
  * @param $post_title
  * @return string
  */
 static function get_single_breadcrumbs($post_title)
 {
     /**
      * check to see if we are on a custom post type page. If that's the case we will load the breadcrumbs
      * via @see td_page_generator::get_custom_post_type_breadcrumbs() - in this file
      */
     global $post;
     if ($post->post_type != 'post') {
         return self::get_custom_post_type_breadcrumbs();
     }
     // get the breadcrumb for single posts - ! if we are on a custom post type, we don't get here !
     if (td_util::get_option('tds_breadcrumbs_show') == 'hide') {
         return '';
     }
     $category_1_name = '';
     $category_1_url = '';
     $category_2_name = '';
     $category_2_url = '';
     $primary_category_id = td_global::get_primary_category_id();
     $primary_category_obj = get_category($primary_category_id);
     //print_r($primary_category_obj);
     if (!empty($primary_category_obj)) {
         if (!empty($primary_category_obj->name)) {
             $category_1_name = $primary_category_obj->name;
         } else {
             $category_1_name = '';
         }
         if (!empty($primary_category_obj->cat_ID)) {
             $category_1_url = get_category_link($primary_category_obj->cat_ID);
         }
         if (!empty($primary_category_obj->parent) and $primary_category_obj->parent != 0) {
             $parent_category_obj = get_category($primary_category_obj->parent);
             if (!empty($parent_category_obj)) {
                 $category_2_name = $parent_category_obj->name;
                 $category_2_url = get_category_link($parent_category_obj->cat_ID);
             }
         }
     }
     if (!empty($category_1_name)) {
         //parent category (only if we have one and if the theme is set to show it)
         if (!empty($category_2_name) and td_util::get_option('tds_breadcrumbs_show_parent') != 'hide') {
             $breadcrumbs_array[] = array('title_attribute' => __td('ๆŸฅ็œ‹ๆ‰€ๆœ‰ๆ–‡็ซ ๏ผš', TD_THEME_NAME) . ' ' . htmlspecialchars($category_2_name), 'url' => $category_2_url, 'display_name' => $category_2_name);
         }
         //child category
         $breadcrumbs_array[] = array('title_attribute' => __td('ๆŸฅ็œ‹ๆ‰€ๆœ‰ๆ–‡็ซ ๏ผš', TD_THEME_NAME) . ' ' . htmlspecialchars($category_1_name), 'url' => $category_1_url, 'display_name' => $category_1_name);
         //article title (only if the theme is set to show it)
         if (td_util::get_option('tds_breadcrumbs_show_article') != 'hide') {
             //child category
             $breadcrumbs_array[] = array('title_attribute' => $post_title, 'url' => '', 'display_name' => td_util::excerpt($post_title, 13));
         }
     }
     if (isset($breadcrumbs_array) and is_array($breadcrumbs_array)) {
         //the breadcrumbs may be empty due to settings
         return self::get_breadcrumbs($breadcrumbs_array);
         //generate the breadcrumbs
     } else {
         return '';
     }
 }
Example #11
0
 function todo()
 {
     //do we enable the unique posts filter?
     $td_unique_articles = get_post_meta($post->ID, 'td_unique_articles', true);
     if (!empty($td_unique_articles['td_unique_articles'])) {
         td_global::$td_unique_articles = true;
     }
 }
 function render($atts, $content = null)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     $buffy = '';
     //output buffer
     extract(shortcode_atts(array('limit' => 4, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'force_columns' => '', 'autoplay' => '', 'offset' => 0), $atts));
     if (empty($td_column_number)) {
         $td_column_number = td_util::vc_get_column_number();
         // get the column width of the block
     }
     if ($td_column_number == 3) {
         $current_limit = intval($limit);
         $post_limit = constant(get_class($this->internal_block_instance) . '::POST_LIMIT');
         $td_query = td_data_source::get_wp_query($atts);
         if (!empty($td_query->posts)) {
             if ($current_limit > $post_limit and count($td_query->posts) > $post_limit) {
                 $buffy .= '<div class="td-big-grid-slide td_block_wrap" id="iosSlider_' . $this->block_uid . '">';
                 $buffy .= '<div class="td-theme-slider td_block_inner" id="' . $this->block_uid . '">';
                 $current_offset = 0;
                 $atts['class'] = 'item';
                 while ($current_limit > 0) {
                     $atts['offset'] = $offset + $current_offset;
                     $buffy .= $this->internal_block_instance->render($atts);
                     $current_offset += $post_limit;
                     $current_limit -= $post_limit;
                 }
                 $buffy .= '</div>';
                 //end slider (if slider)
                 $buffy .= '<i class = "td-icon-left"></i>';
                 $buffy .= '<i class = "td-icon-right"></i>';
                 $buffy .= '</div>';
                 //end iosSlider (if slider)
                 $autoplay_settings = '';
                 $current_autoplay = filter_var($autoplay, FILTER_VALIDATE_INT);
                 if ($current_autoplay !== false) {
                     $autoplay_settings = 'autoSlide: true, autoSlideTimer: ' . $current_autoplay * 1000 . ',';
                 }
                 $slide_javascript = ';jQuery(document).ready(function() {
                     jQuery("#iosSlider_' . $this->block_uid . '").iosSlider({
                         snapToChildren: true,
                         desktopClickDrag: true,
                         keyboardControls: true,
                         responsiveSlides: true,
                         infiniteSlider: true,
                         ' . $autoplay_settings . '
                         navPrevSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-left"),
                         navNextSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-right")
                     });
                 });';
                 td_js_buffer::add_to_footer($slide_javascript);
             } else {
                 $buffy .= $this->internal_block_instance->render($atts);
             }
         }
     }
     return $buffy;
 }
Example #13
0
 /**
  * reading the theme settings
  * if we are in demo mode looks for cookies
  * else takes the settings from database
  */
 static function read_once_theme_settings()
 {
     //this is for demo mode
     if (TD_DEBUG_LIVE_THEME_STYLE) {
         td_theme_settings_read_for_demo();
         //this function is in demo folder td_theme_demo_cookies.php
         //this is for deploy and dev
     } else {
         td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
     }
 }
 static function update_theme_settings($old_theme_settings)
 {
     $settings_buffer = array();
     foreach (self::$td_options_to_be_imported as $option_id) {
         if (isset($old_theme_settings[$option_id]) and !empty($old_theme_settings[$option_id])) {
             $settings_buffer[$option_id] = $old_theme_settings[$option_id];
         }
     }
     td_global::$td_options = $settings_buffer;
     update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
 }
 /**
  * get the single breadcrumbs
  * @param $post_title
  * @return string
  */
 static function get_single_breadcrumbs($post_title)
 {
     if (td_util::get_option('tds_breadcrumbs_show') == 'hide') {
         return;
     }
     $category_1_name = '';
     $category_1_url = '';
     $category_2_name = '';
     $category_2_url = '';
     $primary_category_id = td_global::get_primary_category_id();
     $primary_category_obj = get_category($primary_category_id);
     //print_r($primary_category_obj);
     if (!empty($primary_category_obj)) {
         if (!empty($primary_category_obj->name)) {
             $category_1_name = $primary_category_obj->name;
         } else {
             $category_1_name = '';
         }
         if (!empty($primary_category_obj->cat_ID)) {
             $category_1_url = get_category_link($primary_category_obj->cat_ID);
         }
         if (!empty($primary_category_obj->parent) and $primary_category_obj->parent != 0) {
             $parent_category_obj = get_category($primary_category_obj->parent);
             if (!empty($parent_category_obj)) {
                 $category_2_name = $parent_category_obj->name;
                 $category_2_url = get_category_link($parent_category_obj->cat_ID);
             }
         }
     }
     if (!empty($category_1_name)) {
         //parent category (only if we have one and if the theme is set to show it)
         if (!empty($category_2_name) and td_util::get_option('tds_breadcrumbs_show_parent') != 'hide') {
             $breadcrumbs_array[] = array('title_attribute' => __td('View all posts in', TD_THEME_NAME) . ' ' . htmlspecialchars($category_2_name), 'url' => $category_2_url, 'display_name' => $category_2_name);
         }
         //child category
         $breadcrumbs_array[] = array('title_attribute' => __td('View all posts in', TD_THEME_NAME) . ' ' . htmlspecialchars($category_1_name), 'url' => $category_1_url, 'display_name' => $category_1_name);
         //article title (only if the theme is set to show it)
         if (td_util::get_option('tds_breadcrumbs_show_article') != 'hide') {
             //child category
             $breadcrumbs_array[] = array('title_attribute' => $post_title, 'url' => '', 'display_name' => td_util::excerpt($post_title, 13));
         }
     }
     if (isset($breadcrumbs_array) and is_array($breadcrumbs_array)) {
         //the breadcrumbs may be empty due to settings
         return self::get_breadcrumbs($breadcrumbs_array);
         //generate the breadcrumbs
     } else {
         return '';
     }
 }
 static function render_generic($atts, $list_type)
 {
     $block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     $buffy = '';
     //output buffer
     $buffy .= '<div class="td_block_wrap td_block_video_playlist">';
     $buffy .= '<div id=' . $block_uid . ' class="td_block_inner">';
     //inner content of the block
     $buffy .= self::inner($list_type);
     $buffy .= '</div>';
     $buffy .= '</div> <!-- ./block_video_playlist -->';
     return $buffy;
 }
Example #17
0
 function render($atts)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     extract(shortcode_atts(array('alias' => ''), $atts));
     $buffy = '';
     $buffy .= '<div class="td_block_wrap td_revolution_slider">';
     $buffy .= $this->get_block_title_raw($atts, '');
     $buffy .= '<div class="td_mod_wrap">';
     $buffy .= do_shortcode('[rev_slider ' . $alias . ']');
     $buffy .= '</div>';
     $buffy .= '</div>';
     return $buffy;
 }
Example #18
0
 function render_before_list_wrap()
 {
     if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
         $td_class_nr_of_columns = ' td-3-columns ';
     } else {
         $td_class_nr_of_columns = ' td-2-columns ';
     }
     $buffy = '';
     //generate unique gallery slider id
     $this->smart_list_tip_1_unique_id = 'smart_list_tip1_' . td_global::td_generate_unique_id();
     //wrapper with id for smart list wrapper type 1
     $buffy .= '<div class="td_smart_list_1' . $td_class_nr_of_columns . '">';
     $buffy .= '<div class="td-controls"><a class="td-left-smart-list doubleSliderPrevButton" href="#" onclick="return false;"><i class = "td-icon-left"></i>' . __td('Prev', TD_THEME_NAME) . '</a><a class="td-right-smart-list doubleSliderNextButton" href="#" onclick="return false;">' . __td('Next', TD_THEME_NAME) . '<i class = "td-icon-right"></i></a></div>';
     $buffy .= '<div class="td-iosSlider td-smart-list-slider" id="' . $this->smart_list_tip_1_unique_id . '">';
     $buffy .= '<div class ="td-slider">';
     return $buffy;
 }
Example #19
0
 function render($atts)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'show_child_cat' => '', 'tag_slug' => '', 'header_color' => ''), $atts));
     $buffy = '';
     //output buffer
     $td_unique_id = td_global::td_generate_unique_id();
     //custom categories
     //get subcategories, it returns false if there are no categories
     $get_block_sub_cats = $this->get_block_sub_cats($atts, $td_unique_id);
     $buffy_categories = '';
     $td_no_subcats_class = '';
     //we have subcategories
     if ($get_block_sub_cats !== false) {
         $buffy_categories .= '<div class="td_mega_menu_sub_cats">';
         //get the sub category filter for this block
         $buffy_categories .= $get_block_sub_cats;
         $buffy_categories .= '</div>';
         $atts['limit'] = 4;
         //alter the loop because we don't have space now with the categories
     } else {
         $td_no_subcats_class = ' td-no-subcats';
     }
     //end custom categories
     $td_query =& td_data_source::get_wp_query($atts);
     //by ref  do the query
     //get the js for this block
     $buffy .= $this->get_block_js($atts, $td_query);
     $buffy .= '<div class="td_block_wrap td_block_mega_menu' . $td_no_subcats_class . '">';
     //get the block title
     //$buffy .= $this->get_block_title($atts);
     //add the categories IF we have some
     $buffy .= $buffy_categories;
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner animated fadeInDown">';
     //inner content of the block
     $buffy .= $this->inner($td_query->posts);
     $buffy .= '</div>';
     $buffy .= $this->get_block_pagination($atts, $td_unique_id);
     //get the ajax pagination for this block
     $buffy .= '<div class="clearfix"></div>';
     $buffy .= '</div> <!-- ./block1 -->';
     return $buffy;
 }
 function render($atts, $content = null)
 {
     parent::render($atts);
     // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
     // this block need td_column_number to add rows if more posts are displayed on a post.
     /// the td_column_number is not standard here, it's    5 for full width / 3 for content + sidebar
     extract(shortcode_atts(array('td_column_number' => ''), $atts));
     // we have no related posts to display
     if ($this->td_query->post_count == 0) {
         return;
     }
     $buffy = '';
     //output buffer
     //get the js for this block
     $buffy .= $this->get_block_js();
     $buffy .= '<div class="' . $this->get_block_classes() . '">';
     //get the filter for this block
     $buffy .= '<h4 class="td-related-title">';
     // $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-left td-cur-simple-item" data-td_filter_value="" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('RELATED ARTICLES', TD_THEME_NAME) . '</a>';
     $buffy .= '<span class="title-inner">' . __td('RELATED ARTICLES', TD_THEME_NAME) . '</span>';
     // ZA Custom
     $buffy .= '<div id="related-filter">Filter <img src="/wp-content/uploads/2015/12/icon-caret-down_white.png" alt=""></div>';
     $buffy .= '<div class="td-related-mobile">';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right " data-td_filter_value="td_related_more_from_author" data-td_block_id="' . $this->block_uid . '" href="#"><div class="td-related-mobile-inner"><div class="icon-title"><img class="NEUTRAL" src="/wp-content/uploads/2015/12/icon-articleNeutual.png" alt=""><img class="NEUTRAL-hover" src="/wp-content/uploads/2015/12/icon-articleNeutual-selected.png" alt=""><span> NEUTRAL</span></div></div></a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_tag_slug_filter_happy" data-td_block_id="' . $this->block_uid . '" href="#"><div class="td-related-mobile-inner"><div class="icon-title"><img class="HAPPY" src="/wp-content/uploads/2015/12/icon-articleHappy.png" alt=""><img class="HAPPY-hover" src="/wp-content/uploads/2015/12/icon-articleHappy-selected.png" alt=""><span> HAPPY</span></div></div></a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_tag_slug_filter_funny" data-td_block_id="' . $this->block_uid . '" href="#"><div class="td-related-mobile-inner"><div class="icon-title"><img class="HAPPY" src="/wp-content/uploads/2015/12/icon-articleFunny.png" alt=""><img class="HAPPY-hover" src="/wp-content/uploads/2015/12/icon-articleFunny-selected.png" alt=""><span> FUNNY</span></div></div></a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_tag_slug_filter_romantic" data-td_block_id="' . $this->block_uid . '" href="#"><div class="td-related-mobile-inner"><div class="icon-title"><img class="HAPPY" src="/wp-content/uploads/2015/12/icon-articleRomantic.png" alt=""><img class="HAPPY-hover" src="/wp-content/uploads/2015/12/icon-articleRomantic-selected.png" alt=""><span> ROMANTIC</span></div></div></a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_tag_slug_filter_surprised" data-td_block_id="' . $this->block_uid . '" href="#"><div class="td-related-mobile-inner"><div class="icon-title"><img class="HAPPY" src="/wp-content/uploads/2015/12/icon-articleSurprised.png" alt=""><img class="HAPPY-hover" src="/wp-content/uploads/2015/12/icon-articleSurprised-selected.png" alt=""><span> SURPRISED</span></div></div></a>';
     $buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_tag_slug_filter_sad" data-td_block_id="' . $this->block_uid . '" href="#"><div class="td-related-mobile-inner"><div class="icon-title"><img class="HAPPY" src="/wp-content/uploads/2015/12/icon-articleSad.png" alt=""><img class="HAPPY-hover" src="/wp-content/uploads/2015/12/icon-articleSad-selected.png" alt=""><span> SAD</span></div></div></a>';
     $buffy .= '</div>';
     // End ZA Custom
     $buffy .= '</h4>';
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     $buffy .= $this->inner($this->td_query->posts, $td_column_number);
     //inner content of the block
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination();
     $buffy .= '</div> <!-- ./block -->';
     return $buffy;
 }
 function inner($posts, $td_column_number = '')
 {
     $buffy = '';
     $navigation = '';
     if (!empty($this->atts['navigation'])) {
         $navigation = $this->atts['navigation'];
     }
     $td_block_layout = new td_block_layout();
     if (!empty($posts)) {
         $buffy .= $td_block_layout->open_row();
         $trending_now_unique_id = td_global::td_generate_unique_id();
         //generate unique id for this object
         $buffy .= '<div class="td-trending-now-wrapper" id="' . $trending_now_unique_id . '" data-start="' . esc_attr($navigation) . '">';
         $buffy .= '<div class="td-trending-now-title">' . __td('Trending Now', TD_THEME_NAME) . '</div><div class="td-trending-now-display-area">';
         foreach ($posts as $post_count => $post) {
             $td_module_trending_now = new td_module_trending_now($post);
             $buffy .= $td_module_trending_now->render($post_count);
         }
         $buffy .= '</div>';
         // ZA Cutom
         // $buffy .= '<div class="td-next-prev-wrap">';
         //     $buffy .= '<a href="#"
         //                   class="td_ajax-prev-pagex td-trending-now-nav-left"
         //                   data-wrapper-id="' . $trending_now_unique_id . '"
         //                   data-moving="left"
         //                   data-control-start="' . $navigation . '"><i class="td-icon-menu-left"></i></a>';
         //     $buffy .= '<a href="#"
         //                   class="td_ajax-next-pagex td-trending-now-nav-right"
         //                   data-wrapper-id="' . $trending_now_unique_id . '"
         //                   data-moving="right"
         //                   data-control-start="' . $navigation . '"><i class="td-icon-menu-right"></i></a>';
         // $buffy .= '</div>';
         $buffy .= '</div>';
         $buffy .= $td_block_layout->close_row();
     }
     $buffy .= $td_block_layout->close_all_tags();
     return $buffy;
 }
Example #22
0
 static function load_single_post($post)
 {
     self::$post = $post;
     /*  ----------------------------------------------------------------------------
            update the primary category Only on single posts :0
         */
     if (is_single()) {
         //read the post setting
         $td_post_theme_settings = get_post_meta(self::$post->ID, 'td_post_theme_settings', true);
         if (!empty($td_post_theme_settings['td_primary_cat'])) {
             self::$primary_category = $td_post_theme_settings['td_primary_cat'];
             return;
         }
         $categories = get_the_category(self::$post->ID);
         foreach ($categories as $category) {
             if ($category->name != TD_FEATURED_CAT) {
                 //ignore the featured category name
                 self::$primary_category = $category->cat_ID;
                 break;
             }
         }
     }
 }
Example #23
0
get_header();
//set the template id, used to get the template specific settings
$template_id = 'search';
//prepare the loop variables
global $loop_module_id, $loop_sidebar_position;
/* after */
$loop_module_id = td_util::get_option('tds_' . $template_id . '_page_layout', 16);
//module 16 is default
$loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos');
//sidebar right is default (empty)
// sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue
$td_sidebar_position = '';
if ($loop_sidebar_position == 'sidebar_left') {
    $td_sidebar_position = 'td-sidebar-left';
}
td_global::$custom_no_posts_message = __td('No results for your search', TD_THEME_NAME);
?>
<div class="td-main-content-wrap">

<div class="td-container <?php 
echo $td_sidebar_position;
?>
">
    <div class="td-crumb-container">
        <?php 
echo td_page_generator::get_search_breadcrumbs();
?>
    </div>
    <div class="td-pb-row">
        <?php 
switch ($loop_sidebar_position) {
 static function update()
 {
     //load all the theme's settings
     td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
     /*  ----------------------------------------------------------------------------
            save the data
         */
     //print_r($_POST);
     foreach ($_POST as $post_data_source => $post_value) {
         switch ($post_data_source) {
             case 'td_category':
                 self::update_category($post_value);
                 break;
             case 'td_option':
                 self::update_td_option($post_value);
                 break;
             case 'wp_option':
                 self::update_wp_option($post_value);
                 break;
             case 'td_homepage':
                 break;
             case 'td_page_option':
                 break;
             case 'td_author':
                 self::update_td_author($post_value);
                 break;
             case 'wp_widget':
                 self::update_wp_widget($post_value);
                 break;
             case 'wp_theme_mod':
                 self::update_wp_theme_mod($post_value);
                 break;
             case 'wp_theme_menu_spot':
                 self::update_wp_theme_menu_spot($post_value);
                 break;
             case 'td_translate':
                 self::update_td_translate($post_value);
                 break;
             case 'td_ads':
                 self::update_td_ads($post_value);
                 break;
                 //social networks
             //social networks
             case 'td_social_networks':
                 self::update_td_social_networks($post_value);
                 break;
             case 'td_fonts':
                 self::update_td_fonts($post_value);
                 break;
             case 'td_block_styles':
                 self::update_td_block_styles($post_value);
                 break;
         }
     }
     //compile user css if any
     td_global::$td_options['tds_user_compile_css'] = td_css_generator();
     //save all the themes settings (td_options + td_category)
     update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
 }
<?php

/* Template Name: Pagebuilder + page title */
get_header();
td_global::$current_template = 'page-title-sidebar';
//set the template id, used to get the template specific settings
$template_id = 'page';
$loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos');
//sidebar right is default (empty)
//read the custom single post settings - this setting overids all of them
$td_page = get_post_meta($post->ID, 'td_page', true);
if (!empty($td_page['td_sidebar_position'])) {
    $loop_sidebar_position = $td_page['td_sidebar_position'];
}
// sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue
$td_sidebar_position = '';
if ($loop_sidebar_position == 'sidebar_left') {
    $td_sidebar_position = 'td-sidebar-left';
}
/**
 * detect the page builder
 */
$td_use_page_builder = false;
if (method_exists('WPBMap', 'getShortCodes')) {
    $td_page_builder_short_codes = array_keys(WPBMap::getShortCodes());
    if (td_util::strpos_array($post->post_content, $td_page_builder_short_codes) === true) {
        $td_use_page_builder = true;
    }
}
//no page builder detected, we load a default page template with sidebar / no sidebar
?>
Example #26
0
                <div class="span4 column_container td-post-sidebar" role="complementary" itemscope="itemscope" itemtype="<?php 
        echo td_global::$http_or_https;
        ?>
://schema.org/WPSideBar">
                    <?php 
        get_sidebar();
        ?>
                </div>
                <div class="span8 column_container td-post-content" role="main" itemprop="mainContentOfPage">
                    <?php 
        locate_template('loop-single-5.php', true);
        comments_template('', true);
        ?>
                </div>
                <?php 
        break;
    case 'no_sidebar':
        td_global::$load_featured_img_from_template = 'full';
        ?>
                <div class="span12 column_container td-post-content" role="main" itemprop="mainContentOfPage">
                    <?php 
        locate_template('loop-single-5.php', true);
        comments_template('', true);
        ?>
                </div>
                <?php 
        break;
}
echo td_page_generator::wrap_end();
?>
</article> <!-- /.post -->
    $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');
    if (!empty($tax_meta_sidebar)) {
        //update the sidebar position from the category setting
        $loop_sidebar_position = $tax_meta_sidebar;
    }
}
//read the custom single post settings - this setting overids all of them
$td_post_theme_settings = get_post_meta($post->ID, 'td_post_theme_settings', true);
if (!empty($td_post_theme_settings['td_sidebar_position'])) {
    $loop_sidebar_position = $td_post_theme_settings['td_sidebar_position'];
}
//set the content width if needed (we already have the default in functions)
if ($loop_sidebar_position == 'no_sidebar') {
    $content_width = 980;
}
//send the sidebar position to gallery
td_global::$cur_single_template_sidebar_pos = $loop_sidebar_position;
//increment the views counter
td_page_views::update_page_views($post->ID);
//added by Radu A. check if this post have a post template to be display with.
//if not use the default site post template from Theme Panel -> Post Settings -> Default site post template
$td_default_site_post_template = td_util::get_option('td_default_site_post_template');
if (empty($td_post_theme_settings['td_post_template']) and !empty($td_default_site_post_template)) {
    $td_post_theme_settings['td_post_template'] = $td_default_site_post_template;
}
// sidebar position used to align the breadcrumb on sidebar left
$td_sidebar_position = '';
if ($loop_sidebar_position == 'sidebar_left') {
    $td_sidebar_position = 'td-sidebar-left';
}
    /**
     * this panel box will load an ajax view when it will open
     *  - the ajax views are in /wp-admin/panel/ajax_views
     * @param $panel_text - the display name of the panel
     * @param array $ajax_params - the parameters array that we want to send to the backend. MUST CONTAIN td_ajax_view and td_ajax_call
     * @return the box
     */
    static function ajax_box($panel_text, $ajax_params = array(), $custom_unique_id = '', $panel_class = '')
    {
        if (!empty($custom_unique_id)) {
            $box_uid = $custom_unique_id;
        } else {
            $box_uid = td_global::td_generate_unique_id();
        }
        $tad_ajax_parameters = '';
        if (!empty($ajax_params)) {
            $ajax_params['action'] = 'td_ajax_view_panel_loading';
            //this is added so we can directly send this json-encoded data (no javascript encoding necessary)
            $tad_ajax_parameters = "data-panel-ajax-params='" . json_encode($ajax_params) . "'";
        }
        $buffy = '
        <div class="td-box td-box-close ' . $panel_class . '" id="' . $box_uid . '">
            <div class="td-box-header td-box-header-js-ajax" data-box-id="' . $box_uid . '"  ' . $tad_ajax_parameters . '  unselectable="on">
                <div class="td-box-title">' . $panel_text . '</div>
                <a class="td-box-toggle" data-box-id="' . $box_uid . '" href="#"><div class="td-box-close-open-icon"></div></a>
            </div>

            <div class="td-box-content-wrap"><div class="td-box-content"></div></div>
        </div>
        ';
        return $buffy;
    }
Example #29
0
        locate_template('loop-single-2.php', true);
        comments_template('', true);
        ?>
                            </div>
                        </div>
	                    <div class="td-pb-span4 td-main-sidebar" role="complementary">
		                    <div class="td-ss-main-sidebar">
			                    <?php 
        get_sidebar();
        ?>
		                    </div>
	                    </div>
                        <?php 
        break;
    case 'no_sidebar':
        td_global::$load_featured_img_from_template = 'td_1068x0';
        ?>
                        <div class="td-pb-span12 td-main-content" role="main">
                            <div class="td-ss-main-content">
                                <?php 
        locate_template('loop-single-2.php', true);
        comments_template('', true);
        ?>
                            </div>
                        </div>
                        <?php 
        break;
}
?>
            </div> <!-- /.td-pb-row -->
        </article> <!-- /.post -->
Example #30
0
         td_util::show_sidebar('category');
     }
 } elseif (td_global::$current_template == 'page-homepage-loop') {
     if (!empty(td_global::$load_sidebar_from_template)) {
         //load the template
         dynamic_sidebar(td_global::$load_sidebar_from_template);
     } else {
         //show default
         dynamic_sidebar(TD_THEME_NAME . ' default');
     }
 } elseif (is_attachment()) {
     //custom sidebars for archives
     td_util::show_sidebar('attachment');
 } elseif (is_single()) {
     // sidebar from category on post page
     $primary_category_id = td_global::get_primary_category_id();
     if (!empty($primary_category_id)) {
         $tax_meta_sidebar = td_util::get_category_option($primary_category_id, 'tdc_sidebar_name');
         //swich by RADU A, get_tax_meta($primary_category_id, 'tdc_sidebar_name');
         if (!empty($tax_meta_sidebar)) {
             //show the category one
             dynamic_sidebar($tax_meta_sidebar);
         } else {
             //load the blog one or default
             td_util::show_sidebar('home');
         }
     } else {
         //load the blog one or default
         td_util::show_sidebar('home');
     }
 } elseif (is_home()) {