コード例 #1
0
ファイル: td_global_blocks.php プロジェクト: luxifel/Bionerd
 /**
  * map all the blocks in the pagebuilder
  */
 static function wpb_map_all()
 {
     //print_r(td_block_api::get_all()); die;
     foreach (td_api_block::get_all() as $block_settings) {
         // shortcodes that have no $block_settings['map_in_visual_composer'] are maped!
         // shrotcodes that have $block_settings['map_in_visual_composer'] !== false are maped
         if (isset($block_settings['map_in_visual_composer']) and $block_settings['map_in_visual_composer'] !== false) {
             vc_map($block_settings);
         }
     }
 }
コード例 #2
0
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);
    }
}