當前位置: 首頁>>代碼示例>>PHP>>正文


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怎麽用?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);
    }
}
開發者ID:weerapat,項目名稱:wp-daily,代碼行數:42,代碼來源:td_wp_booster_functions.php

示例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';
開發者ID:vikasjain1595,項目名稱:wordpresstheme,代碼行數:31,代碼來源:functions.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);
     }
 }
開發者ID:Che234,項目名稱:andreatelo,代碼行數:10,代碼來源:td_demo_util.php

示例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++;
 }
開發者ID:Vatia13,項目名稱:wordpress,代碼行數:14,代碼來源:td_demo_site.php

示例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
    }
}
開發者ID:vikasjain1595,項目名稱:wordpresstheme,代碼行數:17,代碼來源:functions.php


注:本文中的td_util::sidebar_name_to_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。