/**
  * 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 :)
 }
Esempio n. 2
0
 function widget($args, $instance)
 {
     /**
      * add the td_block_widget class to the block via the short code atts, we can add td_block_widget multiple times because array_unique in  @see td_block::get_block_classes
      */
     if (!empty($instance['class'])) {
         $instance['class'] = $instance['class'] . ' td_block_widget';
     } else {
         $instance['class'] = 'td_block_widget';
     }
     if (!empty($instance['content'])) {
         //render the instance - but also send the content parameter to the shortcode
         echo td_global_blocks::get_instance($this->td_block_id)->render($instance, $instance['content']);
     } else {
         //render the instance without the content parameter
         echo td_global_blocks::get_instance($this->td_block_id)->render($instance);
     }
 }
Esempio n. 3
0
 protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
 {
     //print_r($item_array);
     $buffy = '';
     // render the pagination
     $buffy .= $this->callback_render_drop_down_pagination();
     // ad smart list 8
     $buffy .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'smart_list_8'));
     //creating each slide
     $buffy .= '<div class="td-item">';
     $buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-title">' . $item_array['title'] . '</span></h2></div>';
     //adding description
     if (!empty($item_array['description'])) {
         $buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
     }
     $buffy .= '</div>';
     // render the pagination
     $buffy .= $this->callback_render_drop_down_pagination();
     return $buffy;
 }
Esempio n. 4
0
 protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
 {
     //print_r($item_array);
     $buffy = '';
     // render the pagination
     $buffy .= $this->callback_render_pagination();
     //creating each slide
     $buffy .= '<div class="td-item">';
     $buffy .= '<h2><span class="td-sml-current-item-title">' . $current_item_number . '. ' . $item_array['title'] . '</span></h2>';
     //get image info
     $first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
     //image caption
     $first_img_caption = '';
     if (!empty($first_img_all_info['caption'])) {
         $first_img_caption = $first_img_all_info['caption'];
     }
     //adding description
     if (!empty($item_array['description'])) {
         $buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
     }
     // ad smart list 6
     $buffy .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'smart_list_7'));
     if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
         $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_1068x0');
     } else {
         $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_696x0');
     }
     if (!empty($first_img_info[0])) {
         $buffy .= '
                         <figure class="td-slide-smart-list-figure td-slide-smart-list-7">
                             <a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '">
                                 <img src="' . $first_img_info[0] . '"/>
                             </a>
                             <figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
                         </figure>';
     }
     // render the pagination
     $buffy .= $this->callback_render_pagination();
     $buffy .= '</div>';
     return $buffy;
 }
Esempio n. 5
0
                }
            }
            echo '</ul>';
            echo '<div class="clearfix"></div>';
        }
    }
}
//the category description
if (!empty($cur_cat_obj->description)) {
    echo '<div class="entry-content">';
    echo $cur_cat_obj->description;
    echo '</div>';
}
//slider
if ($loop_sidebar_position != 'no_sidebar') {
    $td_force_columns = '2';
} else {
    $td_force_columns = '3';
}
//read the category slider settings
$tdc_slider = td_util::get_category_option($cur_cat_obj->cat_ID, 'tdc_slider');
//swich by RADU A,get_tax_meta($cur_cat_obj->cat_ID, 'tdc_slider');
//show only on page 1
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
if ($tdc_slider != 'hide_slider' and $paged == '1') {
    if ($tdc_slider == '') {
        //show small slider
        echo td_global_blocks::get_instance('td_slide')->render(array('category_id' => $cur_cat_obj->cat_ID, 'sort' => 'featured', 'force_columns' => $td_force_columns, 'hide_title' => 'hide_title'));
    } else {
    }
}
Esempio n. 6
0
        // @todo remove this - it keeps compatibility with older visual composer versions
        $class_string = preg_replace('/vc_span(\\d{1,2})/', 'span$1', $class_string);
    }
    return $class_string;
}
// Filter to Replace default css class for vc_row shortcode and vc_column
add_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
/**
 * Force Visual Composer to initialize as "built into the theme". This will hide certain tabs under the Settings->Visual Composer page
 */
if (function_exists('vc_set_as_theme')) {
    vc_set_as_theme();
}
if (function_exists('wpb_map')) {
    //map all of our blocks in page builder
    td_global_blocks::wpb_map_all();
}
if (function_exists('vc_disable_frontend')) {
    vc_disable_frontend();
}
if (class_exists('WPBakeryVisualComposer')) {
    //disable visual composer updater
    $td_composer = WPBakeryVisualComposer::getInstance();
    $td_composer->disableUpdater();
}
/*
to enable all the visual composer features from a child theme, declare an empty td_disable_visual_composer_features function like so in the child's functions.php:

function td_disable_visual_composer_features() {
}
*/
Esempio n. 7
0
/**
 * This function is also callable, it is used to warm the cache for the ajax blocks
 * @param string $ajax_parameters
 * @return mixed
 */
function td_ajax_block($ajax_parameters = '')
{
    $isAjaxCall = false;
    if (empty($ajax_parameters)) {
        $isAjaxCall = true;
        $ajax_parameters = array('td_atts' => '', 'td_column_number' => 0, 'td_current_page' => '', 'td_block_id' => '', 'block_type' => '', 'td_filter_value' => '');
        if (!empty($_POST['td_atts'])) {
            $ajax_parameters['td_atts'] = json_decode(stripslashes($_POST['td_atts']), true);
            //current block args
        }
        if (!empty($_POST['td_column_number'])) {
            $ajax_parameters['td_column_number'] = $_POST['td_column_number'];
            //the block is on x columns
        }
        if (!empty($_POST['td_current_page'])) {
            $ajax_parameters['td_current_page'] = $_POST['td_current_page'];
        }
        if (!empty($_POST['td_block_id'])) {
            $ajax_parameters['td_block_id'] = $_POST['td_block_id'];
        }
        if (!empty($_POST['block_type'])) {
            $ajax_parameters['block_type'] = $_POST['block_type'];
        }
        //read the id for this specific filter type
        if (!empty($_POST['td_filter_value'])) {
            $ajax_parameters['td_filter_value'] = $_POST['td_filter_value'];
            //the new id filter
        }
    }
    /*
     * HANDLES THE PULL DOWN FILTER + TABS ON RELATED POSTS
     * read the block atts - td filter type and overwrite the default values at runtime! (ex: the user changed the category from the dropbox, we overwrite the static default category of the block)
     */
    if (!empty($ajax_parameters['td_atts']['td_ajax_filter_type'])) {
        //dynamic filtering
        switch ($ajax_parameters['td_atts']['td_ajax_filter_type']) {
            case 'td_category_ids_filter':
                // by category  - the user selected a category from the drop down. if it's empty, we show the default block atts
                if (!empty($ajax_parameters['td_filter_value'])) {
                    $ajax_parameters['td_atts']['category_ids'] = $ajax_parameters['td_filter_value'];
                    unset($ajax_parameters['td_atts']['category_id']);
                }
                break;
            case 'td_author_ids_filter':
                // by author
                if (!empty($ajax_parameters['td_filter_value'])) {
                    $ajax_parameters['td_atts']['autors_id'] = $ajax_parameters['td_filter_value'];
                }
                break;
            case 'td_tag_slug_filter':
                // by tag - due to wp query and for combining the tags with categories we have to convert tag_ids to tag_slugs
                if (!empty($ajax_parameters['td_filter_value'])) {
                    $term_obj = get_term($ajax_parameters['td_filter_value'], 'post_tag');
                    $ajax_parameters['td_atts']['tag_slug'] = $term_obj->slug;
                }
                break;
            case 'td_popularity_filter_fa':
                // by popularity (sort)
                if (!empty($ajax_parameters['td_filter_value'])) {
                    $ajax_parameters['td_atts']['sort'] = $ajax_parameters['td_filter_value'];
                }
                break;
                /**
                 * used by the related posts block
                 * - if $td_atts['td_ajax_filter_type'] == td_custom_related  ( this is hardcoded in the block atts  @see td_module_single.php:764)
                 * - overwrite the live_filter for this block - ( the default live_filter is also hardcoded in the block atts  @see td_module_single.php:764)
                 * the default live_filter for this block is: 'live_filter' => 'cur_post_same_categories'
                 * @var $td_filter_value comes via ajax
                 */
            /**
             * used by the related posts block
             * - if $td_atts['td_ajax_filter_type'] == td_custom_related  ( this is hardcoded in the block atts  @see td_module_single.php:764)
             * - overwrite the live_filter for this block - ( the default live_filter is also hardcoded in the block atts  @see td_module_single.php:764)
             * the default live_filter for this block is: 'live_filter' => 'cur_post_same_categories'
             * @var $td_filter_value comes via ajax
             */
            case 'td_custom_related':
                if ($ajax_parameters['td_filter_value'] == 'td_related_more_from_author') {
                    $ajax_parameters['td_atts']['live_filter'] = 'cur_post_same_author';
                    // change the live filter for the related posts
                } else {
                    if ($ajax_parameters['td_filter_value'] == 'td_tag_slug_filter_happy') {
                        $ajax_parameters['td_atts']['live_filter'] = 'cur_post_same_tags_happy';
                        // change the live filter for the related posts
                    } else {
                        if ($ajax_parameters['td_filter_value'] == 'td_tag_slug_filter_funny') {
                            $ajax_parameters['td_atts']['live_filter'] = 'cur_post_same_tags_funny';
                            // change the live filter for the related posts
                        } else {
                            if ($ajax_parameters['td_filter_value'] == 'td_tag_slug_filter_romantic') {
                                $ajax_parameters['td_atts']['live_filter'] = 'cur_post_same_tags_romantic';
                                // change the live filter for the related posts
                            } else {
                                if ($ajax_parameters['td_filter_value'] == 'td_tag_slug_filter_surprised') {
                                    $ajax_parameters['td_atts']['live_filter'] = 'cur_post_same_tags_surprised';
                                    // change the live filter for the related posts
                                } else {
                                    if ($ajax_parameters['td_filter_value'] == 'td_tag_slug_filter_sad') {
                                        $ajax_parameters['td_atts']['live_filter'] = 'cur_post_same_tags_sad';
                                        // change the live filter for the related posts
                                    }
                                }
                            }
                        }
                    }
                }
                // End ZA Custom
                break;
        }
    }
    /**
     * @var WP_Query
     */
    $td_query =& td_data_source::get_wp_query($ajax_parameters['td_atts'], $ajax_parameters['td_current_page']);
    //by ref  do the query
    $buffy = td_global_blocks::get_instance($ajax_parameters['block_type'])->inner($td_query->posts, $ajax_parameters['td_column_number'], '', true);
    // remove whitespaces form the ajax HTML
    $search = array('/\\>[^\\S ]+/s', '/[^\\S ]+\\</s', '/(\\s)+/s');
    $replace = array('>', '<', '\\1');
    $buffy = preg_replace($search, $replace, $buffy);
    // end remove whitespaces
    //pagination
    $td_hide_prev = false;
    $td_hide_next = false;
    if ($ajax_parameters['td_current_page'] == 1) {
        $td_hide_prev = true;
        //hide link on page 1
    }
    if (!empty($ajax_parameters['td_atts']['offset']) && !empty($ajax_parameters['td_atts']['limit']) && $ajax_parameters['td_atts']['limit'] != 0) {
        if ($ajax_parameters['td_current_page'] >= ceil(($td_query->found_posts - $ajax_parameters['td_atts']['offset']) / $ajax_parameters['td_atts']['limit'])) {
            $td_hide_next = true;
            //hide link on last page
        }
    } else {
        if ($ajax_parameters['td_current_page'] >= $td_query->max_num_pages) {
            $td_hide_next = true;
            //hide link on last page
        }
    }
    //    if ($td_current_page >= $td_query->max_num_pages ) {
    //	    $td_hide_next = true; //hide link on last page
    //    }
    $buffyArray = array('td_data' => $buffy, 'td_block_id' => $ajax_parameters['td_block_id'], 'td_hide_prev' => $td_hide_prev, 'td_hide_next' => $td_hide_next);
    if (true === $isAjaxCall) {
        die(json_encode($buffyArray));
    } else {
        return json_encode($buffyArray);
    }
}
 function widget($args, $instance)
 {
     //render the instance
     echo td_global_blocks::get_instance($this->td_block_id)->render($instance);
 }
Esempio n. 9
0
 /**
  * adds mega menu support
  * @param $items
  * @param string $args
  * @return array
  */
 function hook_wp_nav_menu_objects($items, $args = '')
 {
     $items_buffy = array();
     $td_is_firstMenu = true;
     //print_r($items);
     //
     foreach ($items as &$item) {
         // $item->
         /**
          * $item
          *  -> $item (is_mega_menu = true) - this item is a mega menu
          */
         $item->is_mega_menu = false;
         // all items should have this property, we just init it here - when an item has this flag on it means that the item is the mega menu dropdown!
         // first menu fix
         if ($td_is_firstMenu) {
             $item->classes[] = 'menu-item-first';
             $td_is_firstMenu = false;
         }
         // fix the down arros + shortcodes
         if (strpos($item->title, '[') === false) {
         } else {
             //on shortcodes [home] etc.. do not show down arrow
             $item->classes[] = 'td-no-down-arrow';
         }
         //run shortcodes
         $item->title = do_shortcode($item->title);
         // read the menu item metadata!
         $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
         /**
          * check to see if we are in the header menu location and if we have
          */
         if ($this->is_header_menu_mobile === false) {
             /**
              * we are in the header menu location
              */
             if ($td_mega_menu_cat != '') {
                 // check to see if we are having a mega menu item (the item has metadata)
                 //create a mega menu item
                 $item->classes[] = 'td-menu-item';
                 $item->classes[] = 'td-mega-menu';
                 //add the parent menu (ex current menu to the buffer)
                 //print_r($item); //show only the parent item properties
                 $items_buffy[] = $item;
                 //create a new mega menu item: - this is just the dropdown menu / not the parrent
                 $new_item = $this->generate_wp_post();
                 /*
                  * it's a mega menu,
                  * - set the is_mega_menu flag
                  * - alter the last item classes  $last_item
                  * - change the title and url of the current item
                  */
                 $new_item->is_mega_menu = true;
                 //this is sent to the menu walkers
                 $new_item->menu_item_parent = $item->ID;
                 $new_item->url = '';
                 $new_item->title = '<div class="td-mega-grid">';
                 $new_item->title .= td_global_blocks::get_instance('td_mega_menu')->render(array('limit' => '5', 'td_column_number' => 3, 'ajax_pagination' => 'next_prev', 'category_id' => $td_mega_menu_cat, 'show_child_cat' => '5'));
                 $new_item->title .= '</div>';
                 $items_buffy[] = $new_item;
             } else {
                 // the item is just a normal item in the header menu
                 $item->classes[] = 'td-menu-item';
                 $item->classes[] = 'td-normal-menu';
                 $items_buffy[] = $item;
             }
         } else {
             /**
              * we are in the mobile menu location
              */
             if ($td_mega_menu_cat != '') {
                 //this is a mega menu, do a category check
                 //add the parent item
                 $items_buffy[] = $item;
                 //check for subcategories
                 $td_subcategories = get_categories(array('child_of' => $td_mega_menu_cat));
                 if (!empty($td_subcategories)) {
                     $sub_categories_count = 0;
                     foreach ($td_subcategories as $td_category) {
                         if ($sub_categories_count == 5) {
                             // only show 5 subcategories in the mobile menu - the same limit applies to the mega menu
                             break;
                         }
                         $new_item = $this->generate_wp_post();
                         $new_item->is_mega_menu = false;
                         //this is sent to the menu walkers
                         $new_item->menu_item_parent = $item->ID;
                         $new_item->url = get_category_link($td_category->cat_ID);
                         $new_item->title = $td_category->name;
                         $items_buffy[] = $new_item;
                         $sub_categories_count++;
                     }
                 }
             } else {
                 // this item is a normal item in the mobile menu
                 $items_buffy[] = $item;
             }
         }
     }
     //end foreach
     /**
      * double warning :) - this pice of code runs FIRST because it's the mobile menu first
      */
     if ($this->is_header_menu_mobile === true) {
         /*
                 }
         foreach ($items as &$item) {
             $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
             if ($td_mega_menu_cat != '' and $this->is_header_menu_mobile === false) {
         
         
             if ($item->is_mega_menu) {
                 print_r($item);
             }
         }
         
         print_r($items);
         die;
         unset($items_buffy);
         */
     }
     // we have two header-menu locations and the fist one is the mobile menu
     // the second one is the header menu
     if ($args->theme_location == 'header-menu') {
         $this->is_header_menu_mobile = false;
     }
     //print_r($items_buffy);
     //die;
     return $items_buffy;
 }
Esempio n. 10
0
        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 inner($posts, $td_column_number = '')
    {
    }
    function get_map()
    {
        return array("name" => __("Popular category", TD_THEME_NAME), "base" => "td_popular_categories", "class" => "td_popular_categories", "controls" => "full", "category" => __('Blocks', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-popular_categories', "params" => array(array("param_name" => "limit", "type" => "textfield", "value" => "6", "heading" => __("Limit the number of categories shown):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "custom_title", "type" => "textfield", "value" => "", "heading" => __("Optional - custom title for this block:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "custom_url", "type" => "textfield", "value" => "", "heading" => __("Optional - custom url for this block (when the module title is clicked):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "hide_title", "type" => "dropdown", "value" => array('- Show title -' => '', 'Hide title' => 'hide_title'), "heading" => __("Hide block title:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => "")));
    }
}
td_global_blocks::add_instance('td_popular_categories', new td_popular_categories());
Esempio n. 11
0
                        $buffy .= $td_block_layout->open4();
                        $buffy .= $td_module_4->render($post);
                        $buffy .= $td_block_layout->close4();
                        if ($td_current_column == 3) {
                            $buffy .= $td_block_layout->close_row();
                        }
                        break;
                }
                //current column
                if ($td_current_column == $td_column_number) {
                    $td_current_column = 1;
                } else {
                    $td_current_column++;
                }
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        return $buffy;
    }
    function get_map()
    {
        //get the generic filter array
        $generic_filter_array = td_generic_filter_array::get_array();
        //add custom filter fields to generic filter array
        array_push($generic_filter_array, array("param_name" => "limit", "type" => "textfield", "value" => __("5", TD_THEME_NAME), "heading" => __("Limit post number:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => __("", TD_THEME_NAME), "heading" => __("Offset posts:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header text color", TD_THEME_NAME), "param_name" => "header_text_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "custom_title", "type" => "textfield", "value" => "", "heading" => __("Optional - custom title for this block:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "custom_url", "type" => "textfield", "value" => "", "heading" => __("Optional - custom url for this block (when the module title is clicked):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "show_child_cat", "type" => "dropdown", "value" => array('- Hide -' => '', 'Show 1 category' => '1', 'Show 2 categories' => '2', 'Show 3 categories' => '3', 'Show 4 categories' => '4', 'Show 5 categories' => '5', 'Show 6 categories' => '6', 'Show 7 categories' => '7', 'Show 8 categories' => '8', 'Show all' => 'all'), "heading" => __("Show child categories menu:", TD_THEME_NAME), "description" => "This will show a menu at the top of the block that contains the child categories of the selected category. It only works when you're using a single category filter form the dropdown. It doss't work with multiple categories IDs", "holder" => "div", "class" => ""), array("param_name" => "sub_cat_ajax", "type" => "dropdown", "value" => array('- Use ajax -' => '', 'Do not use ajax' => 'n'), "heading" => __("Use ajax in child categories menu:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "ajax_pagination", "type" => "dropdown", "value" => array('- No pagination -' => '', 'Next Prev ajax' => 'next_prev', 'Load More button' => 'load_more', 'Infinite load' => 'infinite'), "heading" => __("Pagination:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""));
        return array("name" => __("Block 5", TD_THEME_NAME), "base" => "td_block5", "class" => "td_block5", "controls" => "full", "category" => __('Blocks', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-block5', "params" => $generic_filter_array);
    }
}
td_global_blocks::add_instance('Block 5', new td_block_5());
Esempio n. 12
0
echo join(' ', get_post_class());
?>
" <?php 
echo $td_mod_single->get_item_scope();
?>
>
            <div class="td-pb-row">
                <div class="td-pb-span12">
                    <div class="td-post-header">
                        <div class="td-crumb-container"><?php 
echo td_page_generator::get_single_breadcrumbs($td_mod_single->title);
?>
</div>

                        <?php 
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'post_style_12'));
?>

                        <header class="td-post-title">
                            <?php 
echo $td_mod_single->get_category();
?>
                            <?php 
echo $td_mod_single->get_title();
?>


                            <?php 
if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) {
    ?>
                                <p class="td-post-sub-title"><?php 
Esempio n. 13
0
                <?php 
locate_template('parts/footer/td_footer_extra.php', true);
?>
                <?php 
dynamic_sidebar('Footer 1');
?>
            </div>

            <div class="td-pb-span4">
                <?php 
td_util::vc_set_column_number(1);
echo td_global_blocks::get_instance('td_block_7')->render(array('custom_title' => __td('POPULAR POSTS', TD_THEME_NAME), 'limit' => 3, 'sort' => 'popular'));
?>
                <?php 
dynamic_sidebar('Footer 2');
?>
            </div>

            <div class="td-pb-span4">
                <?php 
td_util::vc_set_column_number(1);
echo td_global_blocks::get_instance('td_block_popular_categories')->render(array('custom_title' => __td('POPULAR CATEGORIES', TD_THEME_NAME), 'limit' => 9));
?>
                <?php 
dynamic_sidebar('Footer 3');
?>
            </div>
        </div>
    </div>
</div>
     * @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;
    }
}
td_global_blocks::add_lazy_shortcode('td_mega_menu');
Esempio n. 15
0
        snapToChildren: true,
        desktopClickDrag: true,
        keyboardControls: false,
        ' . $autoplay_string . '

        infiniteSlider: true,
        navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"),
        navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton"),
        onSlideComplete: slideContentComplete,
        onSlideStart: slideStartedMoving
    });
});
    ';
        if ($is_ajax) {
            $buffy .= '<script>' . $slide_js . '</script>';
        } else {
            td_js_buffer::add_to_footer($slide_js);
        }
        return $buffy;
    }
    function get_map()
    {
        //get the generic filter array
        $generic_filter_array = td_generic_filter_array::get_array();
        //add custom filter fields to generic filter array
        array_push($generic_filter_array, array("param_name" => "autoplay", "type" => "textfield", "value" => '', "heading" => 'Autoplay slider (at x seconds)', "description" => "Leave empty do disable autoplay", "holder" => "div", "class" => ""), array("param_name" => "limit", "type" => "textfield", "value" => __("5", TD_THEME_NAME), "heading" => __("Limit post number:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => __("", TD_THEME_NAME), "heading" => __("Offset posts:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header text color", TD_THEME_NAME), "param_name" => "header_text_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "custom_title", "type" => "textfield", "value" => "", "heading" => __("Optional - custom title for this block:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "custom_url", "type" => "textfield", "value" => "", "heading" => __("Optional - custom url for this block (when the module title is clicked):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "show_child_cat", "type" => "dropdown", "value" => array('- Hide -' => '', 'Show 1 category' => '1', 'Show 2 categories' => '2', 'Show 3 categories' => '3', 'Show 4 categories' => '4', 'Show 5 categories' => '5', 'Show 6 categories' => '6', 'Show 7 categories' => '7', 'Show 8 categories' => '8', 'Show all' => 'all'), "heading" => __("Show child categories menu:", TD_THEME_NAME), "description" => "This will show a menu at the top of the block that contains the child categories of the selected category. It only works when you're using a single category filter form the dropdown. It doss't work with multiple categories IDs", "holder" => "div", "class" => ""));
        return array("name" => __("Slide", TD_THEME_NAME), "base" => "td_slide", "class" => "td_slide", "controls" => "full", "category" => __('Blocks', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-slide', "params" => $generic_filter_array);
    }
}
td_global_blocks::add_instance('Slide', new td_slide());
Esempio n. 16
0
        $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 .= '<div><a class="cur-sub-cat ajax-sub-cat-mega sub-cat-' . $this->block_uid . '" id="sub-cat-' . $this->block_uid . '-' . $category_id . '" data-cat_id="' . $category_id . '"
                        data-td_block_id="' . $this->block_uid . '" href="' . get_category_link($category_id) . '">' . __td('All') . '</a></div>';
                }
                foreach ($td_subcategories as $td_category) {
                    if (empty($sub_cat_ajax)) {
                        $buffy .= '<div><a class="ajax-sub-cat-mega sub-cat-' . $this->block_uid . '" id="sub-cat-' . $this->block_uid . '-' . $td_category->cat_ID . '" data-cat_id="' . $td_category->cat_ID . '" data-td_block_id="' . $this->block_uid . '" href="' . get_category_link($td_category->cat_ID) . '">' . $td_category->name . '</a></div>';
                    } else {
                        $buffy .= '<div><a href="' . get_category_link($td_category->cat_ID) . '">' . $td_category->name . '</a></div>';
                    }
                }
                $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;
    }
}
td_global_blocks::add_instance('td_mega_menu', new td_mega_menu());
Esempio n. 17
0
                            $buffy .= $td_block_layout->close4();
                            if ($td_current_column == 3) {
                                // column 3
                                $buffy .= $td_block_layout->close_row();
                            }
                        }
                        break;
                }
                //current column
                if ($td_current_column == $td_column_number) {
                    $td_current_column = 1;
                } else {
                    $td_current_column++;
                }
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        return $buffy;
    }
    function get_map()
    {
        //get the generic filter array
        $generic_filter_array = td_generic_filter_array::get_array();
        //add custom filter fields to generic filter array
        array_push($generic_filter_array, array("param_name" => "limit", "type" => "textfield", "value" => __("5", TD_THEME_NAME), "heading" => __("Limit post number:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => __("", TD_THEME_NAME), "heading" => __("Offset posts:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header text color", TD_THEME_NAME), "param_name" => "header_text_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "custom_title", "type" => "textfield", "value" => "", "heading" => __("Optional - custom title for this block:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "custom_url", "type" => "textfield", "value" => "", "heading" => __("Optional - custom url for this block (when the module title is clicked):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "show_child_cat", "type" => "dropdown", "value" => array('- Hide -' => '', 'Show 1 category' => '1', 'Show 2 categories' => '2', 'Show 3 categories' => '3', 'Show 4 categories' => '4', 'Show 5 categories' => '5', 'Show 6 categories' => '6', 'Show 7 categories' => '7', 'Show 8 categories' => '8', 'Show all' => 'all'), "heading" => __("Show child categories menu:", TD_THEME_NAME), "description" => "This will show a menu at the top of the block that contains the child categories of the selected category. It only works when you're using a single category filter form the dropdown. It doss't work with multiple categories IDs", "holder" => "div", "class" => ""), array("param_name" => "sub_cat_ajax", "type" => "dropdown", "value" => array('- Use ajax -' => '', 'Do not use ajax' => 'n'), "heading" => __("Use ajax in child categories menu:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "ajax_pagination", "type" => "dropdown", "value" => array('- No pagination -' => '', 'Next Prev ajax' => 'next_prev', 'Load More button' => 'load_more', 'Infinite load' => 'infinite'), "heading" => __("Pagination:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""));
        return array("name" => __("Block 2", TD_THEME_NAME), "base" => "td_block2", "class" => "td_block2", "controls" => "full", "category" => __('Blocks', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-block2', "params" => $generic_filter_array);
    }
}
td_global_blocks::add_instance('Block 2', new td_block_2());
Esempio n. 18
0
 function hook_wp_nav_menu_objects($items, $args = '')
 {
     $items_buffy = array();
     $td_is_firstMenu = true;
     //print_r($items);
     foreach ($items as &$item) {
         $item->is_mega_menu = false;
         // first menu fix
         if ($td_is_firstMenu) {
             $item->classes[] = 'menu-item-first';
             $td_is_firstMenu = false;
         }
         // fix the down arros + shortcodes
         if (strpos($item->title, '[') === false) {
         } else {
             //on shortcodes [home] etc.. do not show down arrow
             $item->classes[] = 'td-no-down-arrow';
         }
         //run shortcodes
         $item->title = do_shortcode($item->title);
         //is mega menu?
         $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
         if ($td_mega_menu_cat != '' and $this->is_header_menu_mobile === false) {
             $item->classes[] = 'td-not-mega';
             $item->classes[] = 'td-mega-menu';
             //add the parent menu (ex current menu to the buffer)
             $items_buffy[] = $item;
             //create a new mega menu item:
             $post = new stdClass();
             $post->ID = 0;
             $post->post_author = '';
             $post->post_date = '';
             $post->post_date_gmt = '';
             $post->post_password = '';
             $post->post_type = 'menu_tds';
             $post->post_status = 'draft';
             $post->to_ping = '';
             $post->pinged = '';
             $post->comment_status = get_option('default_comment_status');
             $post->ping_status = get_option('default_ping_status');
             $post->post_pingback = get_option('default_pingback_flag');
             $post->post_category = get_option('default_category');
             $post->page_template = 'default';
             $post->post_parent = 0;
             $post->menu_order = 0;
             $new_item = new WP_Post($post);
             //$new_item->
             /*
              * it's a mega menu,
              * - set the is_mega_menu flag
              * - alter the last item classes  $last_item
              * - change the title and url of the current item
              */
             $new_item->is_mega_menu = true;
             //this is sent to the menu walkers
             $new_item->menu_item_parent = $item->ID;
             $new_item->url = '';
             $new_item->title = '<div class="td-mega-grid">';
             $new_item->title .= td_global_blocks::get_instance('td_mega_menu')->render(array('limit' => '5', 'td_column_number' => 3, 'ajax_pagination' => 'next_prev', 'category_id' => $td_mega_menu_cat, 'show_child_cat' => '5'));
             $new_item->title .= '</div>';
             $items_buffy[] = $new_item;
         } else {
             $item->classes[] = 'td-not-mega';
             $items_buffy[] = $item;
         }
     }
     //end foreach
     // we have two header-menu locations and the fist one is the mobile menu
     // the second one is the header menu
     if ($args->theme_location == 'header-menu') {
         $this->is_header_menu_mobile = false;
     }
     //print_r($items_buffy);
     //die;
     return $items_buffy;
 }
Esempio n. 19
0
    }
    function inner($posts, $td_column_number = '')
    {
        //global $post;
        $buffy = '';
        $td_block_layout = new td_block_layout();
        if (empty($td_column_number)) {
            $td_column_number = $td_block_layout->get_column_number();
            // get the column width of the block
        }
        //echo $td_column_number;
        if ($td_column_number == 3 and !empty($posts)) {
            //$td_module_big_grid = new td_module_big_grid();
            $td_module_big_grid = new td_module_slide_big();
            $buffy .= $td_module_big_grid->render(array($posts, $this->td_create_slider, 'iosSlider_' . $this->block_uid));
        }
        $buffy .= $td_block_layout->close_all_tags();
        return $buffy;
    }
    function get_map()
    {
        //get the generic filter array
        $generic_filter_array = td_generic_filter_array::get_array();
        unset($generic_filter_array[5]);
        //add custom filter fields to generic filter array
        array_push($generic_filter_array, array("param_name" => "autoplay", "type" => "textfield", "value" => '', "heading" => '自动播放幻灯片 (在 x 秒)', "description" => "留空禁用自动播放", "holder" => "div", "class" => ""), array("param_name" => "limit", "type" => "textfield", "value" => __("4", TD_THEME_NAME), "heading" => __("限制文章数量:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => __("", TD_THEME_NAME), "heading" => __("偏移文章:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""));
        return array("name" => __("大幻灯片", TD_THEME_NAME), "base" => "td_slide_big", "class" => "td_slide_big", "controls" => "full", "category" => __('区块', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-slide_big', "params" => $generic_filter_array);
    }
}
td_global_blocks::add_instance('Slide big', new td_slide_big());
Esempio n. 20
0
<div class="td-footer-wrapper">
    <div class="td-container">

	    <div class="td-pb-row">
		    <div class="td-pb-span12">
			    <?php 
// ad spot
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'footer_top'));
?>
		    </div>
	    </div>

        <div class="td-pb-row">

            <div class="td-pb-span8">
                <?php 
td_util::vc_set_column_number(2);
dynamic_sidebar('Footer 1');
?>
            </div>

            <div class="td-pb-span4">
                <?php 
td_util::vc_set_column_number(1);
dynamic_sidebar('Footer 2');
?>
            </div>

        </div>
    </div>
</div>
function td_init_booster()
{
    global $content_width;
    // content width - this is overwritten in post
    if (!isset($content_width)) {
        $content_width = 640;
    }
    /* ----------------------------------------------------------------------------
     * add_image_size for WordPress - register all the thumbs from the thumblist
     */
    foreach (td_api_thumb::get_all() as $thumb_array) {
        if (td_util::get_option('tds_thumb_' . $thumb_array['name']) != '') {
            add_image_size($thumb_array['name'], $thumb_array['width'], $thumb_array['height'], $thumb_array['crop']);
        }
    }
    /* ----------------------------------------------------------------------------
     * Add lazy shortcodes of the registered blocks
     */
    foreach (td_api_block::get_all() as $block_settings_key => $block_settings_value) {
        td_global_blocks::add_lazy_shortcode($block_settings_key);
    }
    /* ----------------------------------------------------------------------------
     * register the default sidebars + dynamic ones
     */
    register_sidebar(array('name' => TD_THEME_NAME . ' default', 'id' => 'td-default', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>'));
    register_sidebar(array('name' => 'Footer 1', 'id' => 'td-footer-1', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>'));
    register_sidebar(array('name' => 'Footer 2', 'id' => 'td-footer-2', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>'));
    register_sidebar(array('name' => 'Footer 3', 'id' => 'td-footer-3', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>'));
    //get our custom dynamic sidebars
    $currentSidebars = td_util::get_option('sidebars');
    //if we have user made sidebars, register them in wp
    if (!empty($currentSidebars)) {
        foreach ($currentSidebars as $sidebar) {
            register_sidebar(array('name' => $sidebar, 'id' => 'td-' . td_util::sidebar_name_to_id($sidebar), 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>'));
        }
        //end foreach
    }
    $smooth_scroll = td_util::get_option('tds_smooth_scroll');
    if (!empty($smooth_scroll)) {
        td_js_buffer::add_variable('tds_smooth_scroll', true);
    }
}
Esempio n. 22
0
                        $buffy .= $td_block_layout->open4();
                        $buffy .= $td_module_2->render($post);
                        $buffy .= $td_block_layout->close4();
                        if ($td_current_column == 3) {
                            $buffy .= $td_block_layout->close_row();
                        }
                        break;
                }
                //current column
                if ($td_current_column == $td_column_number) {
                    $td_current_column = 1;
                } else {
                    $td_current_column++;
                }
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        return $buffy;
    }
    function get_map()
    {
        //get the generic filter array
        $generic_filter_array = td_generic_filter_array::get_array();
        //add custom filter fields to generic filter array
        array_push($generic_filter_array, array("param_name" => "limit", "type" => "textfield", "value" => __("5", TD_THEME_NAME), "heading" => __("Limit post number:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => __("", TD_THEME_NAME), "heading" => __("Offset posts:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header text color", TD_THEME_NAME), "param_name" => "header_text_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "custom_title", "type" => "textfield", "value" => "", "heading" => __("Optional - custom title for this block:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "custom_url", "type" => "textfield", "value" => "", "heading" => __("Optional - custom url for this block (when the module title is clicked):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "show_child_cat", "type" => "dropdown", "value" => array('- Hide -' => '', 'Show 1 category' => '1', 'Show 2 categories' => '2', 'Show 3 categories' => '3', 'Show 4 categories' => '4', 'Show 5 categories' => '5', 'Show 6 categories' => '6', 'Show 7 categories' => '7', 'Show 8 categories' => '8', 'Show all' => 'all'), "heading" => __("Show child categories menu:", TD_THEME_NAME), "description" => "This will show a menu at the top of the block that contains the child categories of the selected category. It only works when you're using a single category filter form the dropdown. It doss't work with multiple categories IDs", "holder" => "div", "class" => ""), array("param_name" => "sub_cat_ajax", "type" => "dropdown", "value" => array('- Use ajax -' => '', 'Do not use ajax' => 'n'), "heading" => __("Use ajax in child categories menu:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "ajax_pagination", "type" => "dropdown", "value" => array('- No pagination -' => '', 'Next Prev ajax' => 'next_prev', 'Load More button' => 'load_more', 'Infinite load' => 'infinite'), "heading" => __("Pagination:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""));
        return array("name" => __("Block 7", TD_THEME_NAME), "base" => "td_block7", "class" => "td_block7", "controls" => "full", "category" => __('Blocks', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-block7', "params" => $generic_filter_array);
    }
}
td_global_blocks::add_instance('Block 7', new td_block_7());
Esempio n. 23
0
function td_ajax_block()
{
    //get the data from ajax() call
    $td_atts = '';
    //original block atts
    $td_column_number = 0;
    //should not be 0 (1 - 2 - 3)
    $td_current_page = 1;
    //the current page of the block
    $td_block_id = '';
    //block uid
    $block_type = '';
    //the type of the block?
    /**
     * ajax magic filtering works like this:
     *
     * each block has a js object generated by it that is hardcoded in the page @see td_block::get_block_js
     *
     * 1. ($_POST[td_atts]) -> $td_atts['td_ajax_filter_type'] - the ajax filter type is hardcoded in the block's javascript object in the td_atts variable $td_atts['td_ajax_filter_type']
     * 2. $_POST['td_filter_value'] - the filter value td_filter_value is sent via post $_POST['td_filter_value']
     * 3. $_POST['td_filter_value'] - overwrites the blocks default filters !
     * 4. live_filter - is hardcoded in block's js object or changed by the code here. live_filter's are used to filter content based on current page's author/tags/categories etc
     */
    /**
     * this is retrieved by js from the data-td_filter_value="" attribute of the link that the user has clicked @see td_block::generate_pull_down
     */
    $td_filter_value = '';
    /**
     * this is used to change the new ui filter into focus when the ajax replies ( when a user clicks on 'popular', 'popular' will have this id and it will be put into focus via javascript)
     */
    $td_filter_ui_uid = '';
    if (!empty($_POST['td_atts'])) {
        $td_atts = json_decode(stripslashes($_POST['td_atts']), true);
        //current block args
    }
    if (!empty($_POST['td_column_number'])) {
        $td_column_number = $_POST['td_column_number'];
        //the block is on x columns
    }
    if (!empty($_POST['td_current_page'])) {
        $td_current_page = $_POST['td_current_page'];
    }
    if (!empty($_POST['td_block_id'])) {
        $td_block_id = $_POST['td_block_id'];
    }
    if (!empty($_POST['block_type'])) {
        $block_type = $_POST['block_type'];
    }
    //read the id for this specific filter type
    if (!empty($_POST['td_filter_value'])) {
        $td_filter_value = $_POST['td_filter_value'];
        //the new id filter
    }
    //the clicked filter ui UID from the list
    if (!empty($_POST['td_filter_ui_uid'])) {
        $td_filter_ui_uid = $_POST['td_filter_ui_uid'];
        //the new id filter
    }
    /*
     * HANDLES THE PULL DOWN FILTER + TABS ON RELATED POSTS
     * read the block atts - td filter type and overwrite the default values at runtime! (ex: the user changed the category from the dropbox, we overwrite the static default category of the block)
     */
    if (!empty($td_atts['td_ajax_filter_type'])) {
        //dynamic filtering
        switch ($td_atts['td_ajax_filter_type']) {
            case 'td_category_ids_filter':
                // by category  - the user selected a category from the drop down. if it's empty, we show the default block atts
                if (!empty($td_filter_value)) {
                    $td_atts['category_ids'] = $td_filter_value;
                    unset($td_atts['category_id']);
                }
                break;
            case 'td_author_ids_filter':
                // by author
                if (!empty($td_filter_value)) {
                    $td_atts['autors_id'] = $td_filter_value;
                }
                break;
            case 'td_tag_slug_filter':
                // by tag - due to wp query and for combining the tags with categories we have to convert tag_ids to tag_slugs
                if (!empty($td_filter_value)) {
                    $term_obj = get_term($td_filter_value, 'post_tag');
                    $td_atts['tag_slug'] = $term_obj->slug;
                }
                break;
            case 'td_popularity_filter_fa':
                // by popularity (sort)
                if (!empty($td_filter_value)) {
                    $td_atts['sort'] = $td_filter_value;
                }
                break;
                /**
                 * used by the related posts block
                 * - if $td_atts['td_ajax_filter_type'] == td_custom_related  ( this is hardcoded in the block atts  @see td_module_single.php:764)
                 * - overwrite the live_filter for this block - ( the default live_filter is also hardcoded in the block atts  @see td_module_single.php:764)
                 * the default live_filter for this block is: 'live_filter' => 'cur_post_same_categories'
                 * @var $td_filter_value comes via ajax
                 */
            /**
             * used by the related posts block
             * - if $td_atts['td_ajax_filter_type'] == td_custom_related  ( this is hardcoded in the block atts  @see td_module_single.php:764)
             * - overwrite the live_filter for this block - ( the default live_filter is also hardcoded in the block atts  @see td_module_single.php:764)
             * the default live_filter for this block is: 'live_filter' => 'cur_post_same_categories'
             * @var $td_filter_value comes via ajax
             */
            case 'td_custom_related':
                if ($td_filter_value == 'td_related_more_from_author') {
                    $td_atts['live_filter'] = 'cur_post_same_author';
                    // change the live filter for the related posts
                }
                break;
        }
    }
    //file_put_contents('d:\filename.txt', print_r($_POST, true));
    $td_query =& td_data_source::get_wp_query($td_atts, $td_current_page);
    //by ref  do the query
    $buffy = '';
    $buffy .= td_global_blocks::get_instance($block_type)->inner($td_query->posts, $td_column_number, '', true);
    //pagination
    $td_hide_prev = false;
    $td_hide_next = false;
    if ($td_current_page == 1) {
        $td_hide_prev = true;
        //hide link on page 1
    }
    if (!empty($td_atts['offset']) && !empty($td_atts['limit']) && $td_atts['limit'] != 0) {
        if ($td_current_page >= ceil(($td_query->found_posts - $td_atts['offset']) / $td_atts['limit'])) {
            $td_hide_next = true;
            //hide link on last page
        }
    } else {
        if ($td_current_page >= $td_query->max_num_pages) {
            $td_hide_next = true;
            //hide link on last page
        }
    }
    //    if ($td_current_page >= $td_query->max_num_pages ) {
    //	    $td_hide_next = true; //hide link on last page
    //    }
    $buffyArray = array('td_data' => $buffy, 'td_block_id' => $td_block_id, 'td_hide_prev' => $td_hide_prev, 'td_hide_next' => $td_hide_next, 'td_filter_ui_uid' => $td_filter_ui_uid);
    // Return the String
    die(json_encode($buffyArray));
}
Esempio n. 24
0
        add_shortcode('td_text_with_title', array($this, 'render'));
    }
    function render($atts, $content = null)
    {
        extract(shortcode_atts(array('image_pos' => ''), $atts));
        $td_img_first_class = '';
        if ($image_pos == 'img_first') {
            $td_img_first_class = ' td_img_first';
        }
        $buffy = '';
        $buffy .= '<div class="td_block_wrap td_text_with_title' . $td_img_first_class . '">';
        $buffy .= $this->get_block_title_raw($atts, 'Please select a title');
        $buffy .= '<div class="td_mod_wrap">';
        //only run the filter if we have visual composer
        if (function_exists('wpb_js_remove_wpautop')) {
            $buffy .= wpb_js_remove_wpautop($content);
        } else {
            $buffy .= $content;
            //no visual composer
        }
        $buffy .= '</div>';
        $buffy .= '</div>';
        return $buffy;
    }
    function get_map()
    {
        return array("name" => __("Text with title", TD_THEME_NAME), "base" => "td_text_with_title", "class" => "", "controls" => "full", "category" => __('Content', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-title', "params" => array(array("param_name" => "custom_title", "type" => "textfield", "value" => '', "heading" => "Block title", "description" => "", "holder" => "div", "class" => ""), array("param_name" => "content", "type" => "textarea_html", "holder" => "div", "class" => "", "heading" => __("Text", TD_THEME_NAME), "value" => "", "description" => __("Enter your content.", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header text color", TD_THEME_NAME), "param_name" => "header_text_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "image_pos", "type" => "dropdown", "value" => array('- text first -' => '', 'image first' => 'img_first'), "heading" => __("Alignment:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => "")));
    }
}
td_global_blocks::add_instance('Text with title', new td_text_with_title());
Esempio n. 25
0
 function related_posts($force_sidebar_position = '')
 {
     if (!$this->is_single) {
         return;
     }
     if (td_util::get_option('tds_similar_articles') == 'hide') {
         return;
     }
     //td_global::$cur_single_template_sidebar_pos;
     //cur_post_same_tags
     //cur_post_same_author
     //cur_post_same_categories
     if (td_util::get_option('tds_similar_articles_type') == 'by_tag') {
         $td_related_ajax_filter_type = 'cur_post_same_tags';
     } else {
         $td_related_ajax_filter_type = 'cur_post_same_categories';
     }
     // the number of rows to show. this number will be multiplied with the hardcoded limit
     $tds_similar_articles_rows = td_util::get_option('tds_similar_articles_rows');
     if (empty($tds_similar_articles_rows)) {
         $tds_similar_articles_rows = 1;
     }
     if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar' or $force_sidebar_position === 'no_sidebar') {
         $td_related_limit = 5 * $tds_similar_articles_rows;
         $td_related_class = 'td-related-full-width';
         $td_column_number = 5;
     } else {
         $td_related_limit = 3 * $tds_similar_articles_rows;
         $td_related_class = '';
         $td_column_number = 3;
     }
     /**
      * 'td_ajax_filter_type' => 'td_custom_related' - this ajax filter type overwrites the live filter via ajax @see td_ajax_block
      */
     $td_block_args = array('limit' => $td_related_limit, 'ajax_pagination' => 'next_prev', 'live_filter' => $td_related_ajax_filter_type, 'td_ajax_filter_type' => 'td_custom_related', 'class' => $td_related_class, 'td_column_number' => $td_column_number);
     /**
      * @see td_block_related_posts
      */
     return td_global_blocks::get_instance('td_block_related_posts')->render($td_block_args);
 }
Esempio n. 26
0
                        $buffy .= $td_block_layout->open4();
                        $buffy .= $td_module_3->render($post);
                        $buffy .= $td_block_layout->close4();
                        if ($td_current_column == 3) {
                            $buffy .= $td_block_layout->close_row();
                        }
                        break;
                }
                //current column
                if ($td_current_column == $td_column_number) {
                    $td_current_column = 1;
                } else {
                    $td_current_column++;
                }
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        return $buffy;
    }
    function get_map()
    {
        //get the generic filter array
        $generic_filter_array = td_generic_filter_array::get_array();
        //add custom filter fields to generic filter array
        array_push($generic_filter_array, array("param_name" => "limit", "type" => "textfield", "value" => __("5", TD_THEME_NAME), "heading" => __("Limit post number:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => __("", TD_THEME_NAME), "heading" => __("Offset posts:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header text color", TD_THEME_NAME), "param_name" => "header_text_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME)), array("param_name" => "custom_title", "type" => "textfield", "value" => "", "heading" => __("Optional - custom title for this block:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "custom_url", "type" => "textfield", "value" => "", "heading" => __("Optional - custom url for this block (when the module title is clicked):", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "title_style", "type" => "dropdown", "value" => array('- default style -' => '', 'Style 1' => 'td_title_style_1'), "heading" => __("Title style:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "show_child_cat", "type" => "dropdown", "value" => array('- Hide -' => '', 'Show 1 category' => '1', 'Show 2 categories' => '2', 'Show 3 categories' => '3', 'Show 4 categories' => '4', 'Show 5 categories' => '5', 'Show 6 categories' => '6', 'Show 7 categories' => '7', 'Show 8 categories' => '8', 'Show all' => 'all'), "heading" => __("Show child categories menu:", TD_THEME_NAME), "description" => "This will show a menu at the top of the block that contains the child categories of the selected category. It only works when you're using a single category filter form the dropdown. It doss't work with multiple categories IDs", "holder" => "div", "class" => ""), array("param_name" => "sub_cat_ajax", "type" => "dropdown", "value" => array('- Use ajax -' => '', 'Do not use ajax' => 'n'), "heading" => __("Use ajax in child categories menu:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "ajax_pagination", "type" => "dropdown", "value" => array('- No pagination -' => '', 'Next Prev ajax' => 'next_prev', 'Load More button' => 'load_more', 'Infinite load' => 'infinite'), "heading" => __("Pagination:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""));
        return array("name" => __("Block 4", TD_THEME_NAME), "base" => "td_block4", "class" => "td_block4", "controls" => "full", "category" => __('Blocks', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-block4', "params" => $generic_filter_array);
    }
}
td_global_blocks::add_instance('Block 4', new td_block_4());
Esempio n. 27
0
        //the spot id header / sidebar etc we read it from shortcode
        extract(shortcode_atts(array('spot_id' => '', 'align' => ''), $atts));
        $buffy = '';
        $buffy .= '<div class="td-a-rec td-a-rec-id-' . $spot_id . $align . ' ' . (!empty($ad_array['disable_m']) ? ' td-rec-hide-on-m' : '') . (!empty($ad_array['disable_tl']) ? ' td-rec-hide-on-tl' : '') . (!empty($ad_array['disable_tp']) ? ' td-rec-hide-on-tp' : '') . (!empty($ad_array['disable_p']) ? ' td-rec-hide-on-p' : '') . '">';
        $buffy .= do_shortcode(stripslashes($ad_array['ad_code']));
        $buffy .= '</div>';
        //print_r($ad_array);
        return $buffy;
    }
    function get_map()
    {
        //read the adspots
        $td_ad_spots = td_util::get_option('td_ad_spots');
        $td_pb_ad_spots = array();
        if (!empty($td_ad_spots)) {
            foreach ($td_ad_spots as $td_ad_spot) {
                $td_pb_ad_spots['Ad spot -- ' . $td_ad_spot['name']] = 'Ad spot -- ' . $td_ad_spot['name'];
            }
        }
        //read the google adspots
        $td_adsense_spots = td_util::get_option('td_adsense_spots');
        if (!empty($td_adsense_spots)) {
            foreach ($td_adsense_spots as $td_ad_spot) {
                $td_pb_ad_spots['Adsense spot -- ' . $td_ad_spot['name']] = 'Adsense spot -- ' . $td_ad_spot['name'];
            }
        }
        return array("name" => __("Ad box", TD_THEME_NAME), "base" => "td_ad_box", "class" => "", "controls" => "full", "category" => __('Content', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-ads', "params" => array(array("param_name" => "spot_id", "type" => "dropdown", "value" => array('sidebar' => 'sidebar', 'content_inline' => 'content_inline', 'content_top' => 'content_top', 'content_bottom' => 'content_bottom', 'header' => 'header', 'custom_ad_1' => 'custom_ad_1', 'custom_ad_2' => 'custom_ad_2', 'custom_ad_3' => 'custom_ad_3'), "heading" => __("Use adspot :", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => "")));
    }
}
td_global_blocks::add_instance('Ad box', new td_ad_box());
Esempio n. 28
0
                }
                $buffy .= '<div class="td-fake-click td_mod_wrap' . $current_author_class . '" data-fake-click="' . get_author_posts_url($td_author->ID) . '">';
                $buffy .= '<a href="' . get_author_posts_url($td_author->ID) . '">' . get_avatar($td_author->user_email, '70') . '</a>';
                $buffy .= '<div class="item-details">';
                $buffy .= '<div class="td-authors-name">';
                $buffy .= '<a href="' . get_author_posts_url($td_author->ID) . '">' . $td_author->display_name . '</a>';
                $buffy .= '</div>';
                $buffy .= '<span class="td-author-post-count">';
                $buffy .= count_user_posts($td_author->ID) . ' ' . __td('POSTS');
                $buffy .= '</span>';
                $buffy .= '<span class="td-author-comments-count">';
                $comment_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) AS total FROM {$wpdb->comments} WHERE comment_approved = 1 AND user_id = %s", $td_author->ID));
                $buffy .= $comment_count . ' ' . __td('COMMENTS');
                $buffy .= '</span>';
                $buffy .= '<div class="td-authors-url">';
                $buffy .= '<a href="' . $td_author->user_url . '">' . $td_author->user_url . '</a>';
                $buffy .= '</div>';
                $buffy .= '</div>';
                $buffy .= '</div>';
            }
        }
        $buffy .= '</div>';
        return $buffy;
    }
    function get_map()
    {
        return array("name" => __("Authors box", TD_THEME_NAME), "base" => "td_authors", "class" => "", "controls" => "full", "category" => __('Content', TD_THEME_NAME), 'icon' => 'icon-pagebuilder-td_authors', "params" => array(array("param_name" => "title", "type" => "textfield", "value" => '', "heading" => "Block title", "description" => "", "holder" => "div", "class" => ""), array("param_name" => "sort", "type" => "dropdown", "value" => array('- Sort by name -' => '', 'Sort by post count' => 'post_count'), "heading" => __("Sort authors by:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "exclude", "type" => "textfield", "value" => '', "heading" => "Exclude authors id (, separated)", "description" => "", "holder" => "div", "class" => ""), array("param_name" => "include", "type" => "textfield", "value" => '', "heading" => "Include authors id (, separated) - do not use with exclude", "description" => "", "holder" => "div", "class" => ""), array("type" => "colorpicker", "holder" => "div", "class" => "", "heading" => __("Header color", TD_THEME_NAME), "param_name" => "header_color", "value" => '', "description" => __("Choose a custom header color for this block", TD_THEME_NAME))));
    }
}
td_global_blocks::add_instance('Authors box', new td_authors());
Esempio n. 29
0
 /**
  * adds mega menu support
  * @param $items
  * @param string $args
  * @return array
  */
 function hook_wp_nav_menu_objects($items, $args = '')
 {
     $items_buffy = array();
     $td_is_firstMenu = true;
     //print_r($items);
     foreach ($items as &$item) {
         $item->is_mega_menu = false;
         /**
          * $item
          *  -> $item (is_mega_menu = true) - this item is a mega menu
          */
         $item->is_mega_menu = false;
         // all items should have this property, we just init it here - when an item has this flag on it means that the item is the mega menu dropdown!
         // first menu fix
         if ($td_is_firstMenu) {
             $item->classes[] = 'menu-item-first';
             $td_is_firstMenu = false;
         }
         // fix the down arros + shortcodes
         if (strpos($item->title, '[') === false) {
         } else {
             //on shortcodes [home] etc.. do not show down arrow
             $item->classes[] = 'td-no-down-arrow';
         }
         //run shortcodes
         $item->title = do_shortcode($item->title);
         //read mega menu and mega page menu settings
         $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
         $td_mega_menu_page_id = get_post_meta($item->ID, 'td_mega_menu_page_id', true);
         if ($this->is_header_menu_mobile === true) {
             // a item in the mobile menu
             /**
              * we are in the mobile menu location
              */
             if ($td_mega_menu_cat != '') {
                 //this is a mega menu, do a category check
                 //add the parent item
                 $items_buffy[] = $item;
                 $td_render_atts = td_api_block::get_key('td_block_mega_menu', 'render_atts');
                 $td_show_child_cat = 5;
                 if (isset($td_render_atts['show_child_cat'])) {
                     $td_show_child_cat = $td_render_atts['show_child_cat'];
                 }
                 //check for subcategories
                 $td_subcategories = get_categories(array('child_of' => $td_mega_menu_cat, 'number' => $td_show_child_cat));
                 if (!empty($td_subcategories)) {
                     $item->classes[] = 'menu-item-has-children';
                     // add the extra class for the dropdown to work
                     foreach ($td_subcategories as $td_category) {
                         $new_item = $this->generate_wp_post();
                         $new_item->is_mega_menu = false;
                         //this is sent to the menu walkers
                         $new_item->menu_item_parent = $item->ID;
                         $new_item->url = get_category_link($td_category->cat_ID);
                         $new_item->title = $td_category->name;
                         $items_buffy[] = $new_item;
                     }
                 }
             } else {
                 // this item is a normal item in the mobile menu
                 $items_buffy[] = $item;
             }
         } elseif ($td_mega_menu_page_id != '') {
             // a item with a page - pege mega menu
             // the parent item (the one that appears in the main menu)
             $item->classes[] = 'td-menu-item';
             $item->classes[] = 'td-mega-menu';
             $item->classes[] = 'td-mega-menu-page';
             $items_buffy[] = $item;
             //create a new mega menu item: - this is just the dropdown menu / not the parrent
             $new_item = $this->generate_wp_post();
             $new_item->is_mega_menu = true;
             //this is sent to the menu walkers
             $new_item->menu_item_parent = $item->ID;
             $new_item->url = '';
             //read the page content
             $content_post = get_post($td_mega_menu_page_id);
             $content = $content_post->post_content;
             $content = apply_filters('the_content', $content);
             $content = str_replace(']]>', ']]&gt;', $content);
             $new_item->title = '<div class="td-container-border"><div class="td-mega-grid">';
             // the has_filter check is made for plugins, like bbpress, who think it's okay to remove all filters on 'the_content'
             if (!has_filter('the_content', 'do_shortcode')) {
                 $new_item->title .= do_shortcode($content);
             } else {
                 $new_item->title .= $content;
             }
             $new_item->title .= '</div></div>';
             $items_buffy[] = $new_item;
         } elseif ($td_mega_menu_cat != '') {
             // a item with a category mega menu
             // the parent item (the one that appears in the main menu)
             $item->classes[] = 'td-menu-item';
             $item->classes[] = 'td-mega-menu';
             $items_buffy[] = $item;
             //create a new mega menu item: - this is just the dropdown menu / not the parrent
             $new_item = $this->generate_wp_post();
             /*
              * it's a mega menu,
              * - set the is_mega_menu flag
              * - alter the last item classes  $last_item
              * - change the title and url of the current item
              */
             $new_item->is_mega_menu = true;
             //this is sent to the menu walkers
             $new_item->menu_item_parent = $item->ID;
             $new_item->url = '';
             $new_item->title = '<div class="td-container-border"><div class="td-mega-grid">';
             $td_render_atts = td_api_block::get_key('td_block_mega_menu', 'render_atts');
             $new_item->title .= td_global_blocks::get_instance('td_block_mega_menu')->render(array('limit' => '5', 'td_column_number' => 3, 'ajax_pagination' => 'next_prev', 'category_id' => $td_mega_menu_cat, 'show_child_cat' => $td_render_atts['show_child_cat'], 'td_ajax_filter_type' => 'td_category_ids_filter'));
             $new_item->title .= '</div></div>';
             $items_buffy[] = $new_item;
         } else {
             // normal menu item
             $item->classes[] = 'td-menu-item';
             $item->classes[] = 'td-normal-menu';
             $items_buffy[] = $item;
         }
     }
     //end foreach
     // we have two header-menu locations and the fist one is the mobile menu
     // the second one is the header menu
     if ($args->theme_location == 'header-menu') {
         $this->is_header_menu_mobile = false;
     }
     //print_r($items_buffy);
     //die;
     return $items_buffy;
 }
Esempio n. 30
0
://schema.org/Organization">
                <div class="td-logo-wrap-align">
                    <a itemprop="url" class="td-logo-wrap" href="<?php 
echo home_url();
?>
">
                        <span class="td-logo-text"><?php 
echo get_bloginfo('name');
?>
</span>
                        <span class="td-tagline-text"><?php 
echo get_bloginfo('description');
?>
</span>
                    </a>
                </div>
                <meta itemprop="name" content="<?php 
bloginfo('name');
?>
">
            </div>
            <div class="span8">
                <?php 
// show the header ad spot
echo td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'header'));
?>
            </div>
        </div>
    </div>
</div>