本文整理汇总了PHP中td_global_blocks类的典型用法代码示例。如果您正苦于以下问题:PHP td_global_blocks类的具体用法?PHP td_global_blocks怎么用?PHP td_global_blocks使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了td_global_blocks类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_posts_to_buffer
/**
* 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 :)
}
示例2: widget
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);
}
}
示例3: render_list_item
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;
}
示例4: render_list_item
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;
}
示例5: get_query_var
}
}
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 {
}
}
示例6: preg_replace
// @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() {
}
*/
示例7: td_ajax_block
//.........这里部分代码省略.........
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);
}
}
示例8: widget
function widget($args, $instance)
{
//render the instance
echo td_global_blocks::get_instance($this->td_block_id)->render($instance);
}
示例9: hook_wp_nav_menu_objects
/**
* 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 {
//.........这里部分代码省略.........
示例10: extract
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());
示例11: get_map
$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());
示例12: join
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
示例13: locate_template
<?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>
示例14: get_pull_down_filter
* @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');
示例15: jQuery
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());