本文整理汇总了PHP中td_global_blocks::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP td_global_blocks::get_instance方法的具体用法?PHP td_global_blocks::get_instance怎么用?PHP td_global_blocks::get_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_global_blocks
的用法示例。
在下文中一共展示了td_global_blocks::get_instance方法的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: td_ajax_block
//.........这里部分代码省略.........
$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));
}
示例6: 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 {
}
}
示例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: 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 {
//.........这里部分代码省略.........
示例9: home_url
://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>
示例10: td_ajax_block
function td_ajax_block()
{
global $post;
//get the data from ajax() call
if (!empty($_POST['td_atts'])) {
$td_atts = json_decode(stripslashes($_POST['td_atts']), true);
//current block args
} else {
$td_atts = '';
//not ok
}
if (!empty($_POST['td_cur_cat'])) {
$td_cur_cat = $_POST['td_cur_cat'];
//the new id filter
} else {
$td_cur_cat = '';
}
if (!empty($_POST['td_column_number'])) {
$td_column_number = $_POST['td_column_number'];
//the block is on x columns
} else {
$td_column_number = 0;
//not ok
}
if (!empty($_POST['td_current_page'])) {
$td_current_page = $_POST['td_current_page'];
} else {
$td_current_page = 1;
}
if (!empty($td_cur_cat)) {
$td_atts['category_ids'] = $td_cur_cat;
unset($td_atts['category_id']);
}
if (!empty($_POST['td_block_id'])) {
$td_block_id = $_POST['td_block_id'];
} else {
$td_block_id = '';
//not ok
}
if (!empty($_POST['block_type'])) {
$block_type = $_POST['block_type'];
} else {
$block_type = '';
}
$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 ($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_cur_cat' => $td_cur_cat, 'td_hide_prev' => $td_hide_prev, 'td_hide_next' => $td_hide_next);
// Return the String
die(json_encode($buffyArray));
}
示例11:
<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>
示例12: hook_wp_nav_menu_objects
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;
}
示例13: widget
function widget($args, $instance)
{
//render the instance
echo td_global_blocks::get_instance($this->td_block_id)->render($instance);
}
示例14: get_content
function get_content()
{
/* ----------------------------------------------------------------------------
Prepare the content
*/
$content = get_the_content(__td('Continue', TD_THEME_NAME));
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
/* ----------------------------------------------------------------------------
Smart list support @todo reorganizare partea asta
*/
$td_smart_list = get_post_meta($this->post->ID, 'td_smart_list', true);
if (!empty($td_smart_list['smart_list_template'])) {
switch ($td_smart_list['smart_list_template']) {
case 'td_smart_list_1':
$td_smart_list_obj = new td_smart_list_1();
break;
case 'td_smart_list_2':
$td_smart_list_obj = new td_smart_list_2();
break;
case 'td_smart_list_3':
$td_smart_list_obj = new td_smart_list_3();
break;
case 'td_smart_list_4':
$td_smart_list_obj = new td_smart_list_4();
break;
}
if (isset($td_smart_list_obj)) {
return $td_smart_list_obj->render_from_post_content($content);
} else {
//there was an error?
}
}
/* ----------------------------------------------------------------------------
end smart list - if we have a list, the function returns above
*/
/* ----------------------------------------------------------------------------
ad support on content
*/
$tds_inline_ad_paragraph = td_util::get_option('tds_inline_ad_paragraph');
$tds_inline_ad_align = td_util::get_option('tds_inline_ad_align');
if (td_util::is_ad_spot_enabled('content_inline') and is_single()) {
if (empty($tds_inline_ad_paragraph)) {
$tds_inline_ad_paragraph = 0;
}
$content_buffer = '';
// we replace the content with this buffer at the end
$content_parts = preg_split('/(<p.*>)/U', $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
//print_r($content_parts);
//die;
//$content_parts = explode('<p>', $content);
foreach ($content_parts as $content_part_index => $content_part) {
if (!empty($content_part)) {
if ($tds_inline_ad_paragraph == $content_part_index / 2) {
//we have 0 = > <p> 1 => content - that's why we have to divide by 2
//it's time to show the ad
switch ($tds_inline_ad_align) {
case 'left':
$content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'left'));
break;
case 'right':
$content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'right'));
break;
default:
$content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline'));
break;
}
}
$content_buffer .= $content_part;
}
}
//end foreach
$content = $content_buffer;
}
//add bottom ad
if (td_util::is_ad_spot_enabled('content_bottom') and is_single()) {
$content = $content . td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_bottom'));
}
return $content;
}
示例15: get_query_var
}
}
$buffy .= '</ul>';
$buffy .= '<div class="clearfix"></div>';
$buffy .= '</div>';
}
//get the `filter_by` URL ($_GET) variable
$filter_by = get_query_var('filter_by');
$td_category_big_grid_drop_down_filter_options = array(array('id' => 'latest', 'value' => $category_link, 'caption' => __td('Latest')), array('id' => 'featured', 'value' => add_query_arg('filter_by', 'featured', $category_link), 'caption' => __td('Featured posts')), array('id' => 'popular', 'value' => add_query_arg('filter_by', 'popular', $category_link), 'caption' => __td('Most popular')), array('id' => 'popular7', 'value' => add_query_arg('filter_by', 'popular7', $category_link), 'caption' => __td('7 days popular')), array('id' => 'review_high', 'value' => add_query_arg('filter_by', 'review_high', $category_link), 'caption' => __td('By review score')), array('id' => 'random_posts', 'value' => add_query_arg('filter_by', 'random_posts', $category_link), 'caption' => __td('Random')));
// is a flag to hide the 'No posts to display' message if on category page there are between 1 and 5 posts
$global_flag_to_hide_no_post_to_display = '';
//this flag is checked in the loop.php file to hide the `No posts to display` message if we have the big grid on the page and there are between 1 and 5 posts
$global_flag_to_hide_no_post_to_display = $wp_query->post_count;
//if there are post to display add also the drop down category filter
if ($td_disable_big_grid != 'yes') {
echo $buffy;
//create the drop-down filter on category pages
echo td_util::generate_category_pull_down($td_category_big_grid_drop_down_filter_options, $filter_by);
//print_r($global_flag_to_hide_no_post_to_display);
//only show the big grid on first page
if ($paged < 2) {
//parameters to filter to for big grid
$atts_for_big_grid = array('limit' => '5', 'category_id' => $cur_cat_id);
//add the sorting option to the big_grid
if (!empty($filter_by)) {
$atts_for_big_grid['sort'] = $filter_by;
}
//show the big grid
echo td_global_blocks::get_instance('td_block_big_grid')->render($atts_for_big_grid);
}
}