本文整理汇总了PHP中td_global_blocks::add_lazy_shortcode方法的典型用法代码示例。如果您正苦于以下问题:PHP td_global_blocks::add_lazy_shortcode方法的具体用法?PHP td_global_blocks::add_lazy_shortcode怎么用?PHP td_global_blocks::add_lazy_shortcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_global_blocks
的用法示例。
在下文中一共展示了td_global_blocks::add_lazy_shortcode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: td_init_booster
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);
}
}
示例2: __td
$buffy .= '<h4 class="td-related-title">';
$buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-left td-cur-simple-item" data-td_filter_value="" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('RELATED ARTICLES') . '</a>';
$buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_related_more_from_author" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('MORE FROM AUTHOR') . '</a>';
$buffy .= '</h4>';
$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
$buffy .= $this->inner($this->td_query->posts);
//inner content of the block
$buffy .= '</div>';
//get the ajax pagination for this block
$buffy .= $this->get_block_pagination();
$buffy .= '</div> <!-- ./block -->';
return $buffy;
}
function inner($posts, $td_column_number = '')
{
$buffy = '';
$buffy .= '<div class="td-related-row">';
if (!empty($posts)) {
foreach ($posts as $post) {
$td_module_related_posts = new td_module_related_posts($post);
$buffy .= '<div class="td-related-span4">';
$buffy .= $td_module_related_posts->render();
$buffy .= '</div>';
}
}
$buffy .= '</div>';
return $buffy;
}
}
td_global_blocks::add_lazy_shortcode('td_related_posts');
示例3: 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');
示例4: td_init_booster
function td_init_booster()
{
/* ----------------------------------------------------------------------------
* add_image_size for WordPress - register all the thumbs from the thumblist
*/
foreach (td_global::$thumbs_list 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_global::$blocks_map_list as $block_settings_key => $block_settings_value) {
td_global_blocks::add_lazy_shortcode($block_settings_key);
}
}