本文整理汇总了PHP中td_util::sidebar_name_to_id方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::sidebar_name_to_id方法的具体用法?PHP td_util::sidebar_name_to_id怎么用?PHP td_util::sidebar_name_to_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_util
的用法示例。
在下文中一共展示了td_util::sidebar_name_to_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: add_theme_support
add_theme_support('automatic-feed-links');
/* ----------------------------------------------------------------------------
Register the themes default sidebars + dinamic ones
*/
//register the default sidebar
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' => 'Top right (social)', 'id' => 'td-top-right', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''));
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
}
/* -----------------------------------------------------------------------------
WP-ADMIN section
*/
if (is_admin()) {
/*
* the wp-admin TinyMCE editor buttons
*/
require_once 'wp-admin/tinymce/tinymce.php';
/*
* Custom content metaboxes (the select sidebar dropdown/post etc)
*/
require_once 'wp-admin/content-metaboxes/td_templates_settings.php';
示例3: remove_widgets_from_sidebar
static function remove_widgets_from_sidebar($sidebar_id)
{
$sidebar_id = td_util::sidebar_name_to_id($sidebar_id);
$sidebars_widgets = get_option('sidebars_widgets');
if (isset($sidebars_widgets['td-' . $sidebar_id])) {
//empty the default sidebar
unset($sidebars_widgets['td-' . $sidebar_id]);
update_option('sidebars_widgets', $sidebars_widgets);
}
}
示例4: add_widget_to_sidebar
function add_widget_to_sidebar($sidebar_name, $widget_name, $atts)
{
$widget_instances = get_option('widget_' . $widget_name);
//in the demo mode, all the widgets will have an istance id of 70+
$widget_instances[$this->last_widget_instance] = $atts;
//add the widget instance to the database
update_option('widget_' . $widget_name, $widget_instances);
$sidebars_widgets = get_option('sidebars_widgets');
$sidebars_widgets['td-' . td_util::sidebar_name_to_id($sidebar_name)][$this->last_sidebar_widget_position] = $widget_name . '-' . $this->last_widget_instance;
update_option('sidebars_widgets', $sidebars_widgets);
$this->log("add_widget_to_sidebar", "Added widget {$widget_name} to sidebar {$sidebar_name}");
$this->last_sidebar_widget_position++;
$this->last_widget_instance++;
}
示例5: td_sidebars_init
function td_sidebars_init()
{
//register the default sidebar
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
}
}