当前位置: 首页>>代码示例>>PHP>>正文


PHP dynamic_sidebar函数代码示例

本文整理汇总了PHP中dynamic_sidebar函数的典型用法代码示例。如果您正苦于以下问题:PHP dynamic_sidebar函数的具体用法?PHP dynamic_sidebar怎么用?PHP dynamic_sidebar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dynamic_sidebar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sidebar_shortcode

 function sidebar_shortcode($atts, $content = null)
 {
     global $wp_registered_sidebars, $wp_registered_widgets;
     extract(shortcode_atts(array('alias' => false), $atts));
     if ($alias) {
         // find the sidebar ID by the alias
         $sidebars = $this->get_sidebars();
         foreach ($sidebars as $key => $value) {
             if (isset($value['alias']) && $value['alias'] == $alias) {
                 $id = $key;
                 break;
             }
         }
         if ($id) {
             // turn on output buffering to capture output
             ob_start();
             // generate sidebar
             dynamic_sidebar($id);
             // get output content
             $content = ob_get_clean();
             // return the content
             return $content;
         }
     }
 }
开发者ID:ArnaudGuillou,项目名称:SiteESBVolley,代码行数:25,代码来源:object.php

示例2: example_widget

function example_widget($content)
{
    if (is_home() && is_active_sidebar('example') && is_main_query()) {
        dynamic_sidebar('example');
    }
    return $content;
}
开发者ID:AthelasPeru,项目名称:oniros,代码行数:7,代码来源:widgets.php

示例3: genesis_footer_widget_areas

/**
 * Echos the markup necessary to facilitate the footer widget areas.
 *
 * Checks for a numerical parameter given when adding theme support - if none is
 * found, then the function returns early.
 *
 * The child theme must style the widget areas.
 *
 * @since 1.6.0
 *
 * @return null Returns early if number of widget areas could not be determined,
 * or nothing is added to the first widget area
 */
function genesis_footer_widget_areas()
{
    $footer_widgets = get_theme_support('genesis-footer-widgets');
    if (!$footer_widgets || !isset($footer_widgets[0]) || !is_numeric($footer_widgets[0])) {
        return;
    }
    $footer_widgets = (int) $footer_widgets[0];
    /**
     * Check to see if first widget area has widgets. If not,
     * do nothing. No need to check all footer widget areas.
     */
    if (!is_active_sidebar('footer-1')) {
        return;
    }
    $output = '';
    $counter = 1;
    while ($counter <= $footer_widgets) {
        /** Darn you, WordPress! Gotta output buffer. */
        ob_start();
        dynamic_sidebar('footer-' . $counter);
        $widgets = ob_get_clean();
        $output .= sprintf('<div class="footer-widgets-%d widget-area">%s</div>', $counter, $widgets);
        $counter++;
    }
    echo apply_filters('genesis_footer_widget_areas', sprintf('<div id="footer-widgets" class="footer-widgets">%2$s%1$s%3$s</div>', $output, genesis_structural_wrap('footer-widgets', 'open', 0), genesis_structural_wrap('footer-widgets', 'close', 0)));
}
开发者ID:hscale,项目名称:webento,代码行数:39,代码来源:footer.php

示例4: get_sidebar

 /**
  * called by the action get_sidebar. this is what places this into the theme
  */
 public static function get_sidebar($index = 'default-sidebar')
 {
     wp_reset_query();
     global $wp_query;
     $post = $wp_query->get_queried_object();
     if (is_post_type_archive('product')) {
         $post = get_post(woocommerce_get_page_id('shop'));
     }
     if (isset($post->ID)) {
         $selected_sidebar = get_post_meta($post->ID, '_selected_sidebar', true);
     } else {
         $selected_sidebar = "";
     }
     if ($selected_sidebar != '' && $selected_sidebar != "0") {
         echo "\n\n<!-- begin generated sidebar [{$selected_sidebar}] -->\n";
         //echo "<!-- selected: $selected_sidebar -->";
         dynamic_sidebar('ht_' . $selected_sidebar);
         echo "\n<!-- end generated sidebar -->\n\n";
     } else {
         //dynamic_sidebar($index);
         if (!function_exists('dynamic_sidebar') || !dynamic_sidebar($index)) {
             //echo '<div id="search" class="widget widget_search">';
             //get_search_form();
             //echo '</div>';
         }
     }
 }
开发者ID:naffan2014,项目名称:greenhomeland,代码行数:30,代码来源:sidebar_generator.php

示例5: woocommerce_us_after_content

    function woocommerce_us_after_content()
    {
        ?>
		</div>
		</div>
		<div class="l-sidebar at_left">
			<div class="l-sidebar-h i-widgets">
				<?php 
        if (defined('SIDEBAR_POS') and SIDEBAR_POS == 'left') {
            dynamic_sidebar('shop_sidebar');
        }
        ?>
			</div>
		</div>

		<div class="l-sidebar at_right">
			<div class="l-sidebar-h i-widgets">
				<?php 
        if (defined('SIDEBAR_POS') and SIDEBAR_POS == 'right') {
            dynamic_sidebar('shop_sidebar');
        }
        ?>
			</div>
		</div>
		</div>
		</div>
	<?php 
    }
开发者ID:ConceptHaus,项目名称:atra,代码行数:28,代码来源:woocommerce.php

示例6: do_widget_area

function do_widget_area($atts)
{
    global $wp_registered_widgets, $_wp_sidebars_widgets, $wp_registered_sidebars;
    extract(shortcode_atts(array('widget_area' => 'widgets_for_shortcodes', 'class' => 'amr-widget-area', 'widget_area_class' => '', 'widget_classes' => ''), $atts));
    if (empty($wp_registered_sidebars[$widget_area])) {
        echo '<br/>Widget area "' . $widget_area . '" not found. Registered widget areas (sidebars) are: <br/>';
        foreach ($wp_registered_sidebars as $area => $sidebar) {
            echo $area . '<br />';
        }
    }
    if (isset($_REQUEST['do_widget_debug']) and current_user_can('administrator')) {
        var_dump($wp_registered_sidebars);
    }
    /**/
    if ($widget_area_class == 'none') {
        $class = '';
    } else {
        if (!empty($widget_area_class)) {
            //2014 08
            $class .= 'class="' . $class . ' ' . $widget_area_class . '"';
        } else {
            $class = 'class="' . $class . '"';
        }
    }
    if (!empty($widget_classes) and $widget_classes == 'none') {
        add_filter('dynamic_sidebar_params', 'amr_remove_widget_class');
    }
    ob_start();
    /* catch the echo output, so we can control where it appears in the text  */
    dynamic_sidebar($widget_area);
    $output = ob_get_clean();
    remove_filter('dynamic_sidebar_params', 'amr_remove_widget_class');
    $output = PHP_EOL . '<div id="' . $widget_area . '" ' . $class . '>' . $output . '</div>' . PHP_EOL;
    return $output;
}
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:35,代码来源:amr-shortcode-any-widget.php

示例7: genesis_footer_widget_areas

/**
 * Echo the markup necessary to facilitate the footer widget areas.
 *
 * Check for a numerical parameter given when adding theme support - if none is found, then the function returns early.
 *
 * The child theme must style the widget areas.
 *
 * Applies the `genesis_footer_widget_areas` filter.
 *
 * @since 1.6.0
 *
 * @uses genesis_structural_wrap() Optionally adds wrap with footer-widgets context.
 *
 * @return null Return early if number of widget areas could not be determined, or nothing is added to the first widget area.
 */
function genesis_footer_widget_areas()
{
    $footer_widgets = get_theme_support('genesis-footer-widgets');
    if (!$footer_widgets || !isset($footer_widgets[0]) || !is_numeric($footer_widgets[0])) {
        return;
    }
    $footer_widgets = (int) $footer_widgets[0];
    //* Check to see if first widget area has widgets. If not, do nothing. No need to check all footer widget areas.
    if (!is_active_sidebar('footer-1')) {
        return;
    }
    $inside = '';
    $output = '';
    $counter = 1;
    while ($counter <= $footer_widgets) {
        //* Darn you, WordPress! Gotta output buffer.
        ob_start();
        dynamic_sidebar('footer-' . $counter);
        $widgets = ob_get_clean();
        if ($widgets) {
            $inside .= sprintf('<div class="footer-widgets-%d widget-area">%s</div>', $counter, $widgets);
        }
        $counter++;
    }
    if ($inside) {
        $output .= genesis_markup(array('html5' => '<div %s>' . genesis_sidebar_title('Footer'), 'xhtml' => '<div id="footer-widgets" class="footer-widgets">', 'context' => 'footer-widgets', 'echo' => false));
        $output .= genesis_structural_wrap('footer-widgets', 'open', 0);
        $output .= $inside;
        $output .= genesis_structural_wrap('footer-widgets', 'close', 0);
        $output .= '</div>';
    }
    echo apply_filters('genesis_footer_widget_areas', $output, $footer_widgets);
}
开发者ID:robalford,项目名称:alfordhomesinc,代码行数:48,代码来源:footer.php

示例8: pw_second_sidebar

function pw_second_sidebar()
{
    echo pw_function_handle(__FUNCTION__);
    if (!dynamic_sidebar("second-sidebar")) {
        echo '<div class="warning clear fl"><p>' . __("Add widgets to the Second Sidebar ", "presswork") . '<a href="' . admin_url('widgets.php') . '">' . __("here", "presswork") . '</a>.</p></div>';
    }
}
开发者ID:Runemester,项目名称:PressWork,代码行数:7,代码来源:actions.php

示例9: reactor_do_footer_widgets

/**
 * Footer widgets
 * in footer.php
 * 
 * @since 1.0.0
 */
function reactor_do_footer_widgets()
{
    ?>
	<div class="row">
		<div class="large-2 medium-6 small-12 columns">
			<div class="inner-footer quick-links">
				<?php 
    dynamic_sidebar('footer-left');
    ?>
       
			</div><!-- .inner-footer -->
		</div><!-- .columns -->
		<div class="large-2 medium-6 small-12 columns">
			<div class="inner-footer footer-location">
				<?php 
    dynamic_sidebar('footer-middle');
    ?>
       
			</div><!-- .inner-footer -->
		</div><!-- .columns -->
		<div class="large-8 medium-12 columns">
			<div class="inner-footer">
				<?php 
    dynamic_sidebar('footer-facebook');
    ?>
       
			</div><!-- .inner-footer -->
		</div><!-- .columns -->
	</div><!-- .row -->
<?php 
}
开发者ID:aaronfrey,项目名称:PepperLillie-Cambridge,代码行数:37,代码来源:content-footer.php

示例10: wp_list_widget_controls

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param string $sidebar
 */
function wp_list_widget_controls($sidebar)
{
    add_filter('dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar');
    echo "\t<div id='{$sidebar}' class='widgets-sortables'>\n";
    dynamic_sidebar($sidebar);
    echo "\t</div>\n";
}
开发者ID:alicam,项目名称:wordpress,代码行数:14,代码来源:widgets.php

示例11: jumbotron_content

 function jumbotron_content()
 {
     global $ss_settings, $ss_framework;
     $hero = false;
     $site_style = $ss_settings['site_style'];
     $visibility = $ss_settings['jumbotron_visibility'];
     $nocontainer = $ss_settings['jumbotron_nocontainer'];
     if (($visibility == 1 && is_front_page() || $visibility != 1) && is_active_sidebar('jumbotron')) {
         $hero = true;
     }
     if ($hero) {
         echo $ss_framework->clearfix();
         echo '<div class="before-main-wrapper">';
         if ($site_style == 'boxed' && $nocontainer != 1) {
             echo '<div class="' . Shoestrap_Layout::container_class() . '">';
         }
         echo '<div class="jumbotron">';
         if ($nocontainer != 1 && $site_style == 'wide' || $site_style == 'boxed') {
             echo '<div class="' . Shoestrap_Layout::container_class() . '">';
         }
         dynamic_sidebar('Jumbotron');
         if ($nocontainer != 1 && $site_style == 'wide' || $site_style == 'boxed') {
             echo '</div>';
         }
         echo '</div>';
         if ($site_style == 'boxed' && $nocontainer != 1) {
             echo '</div>';
         }
         echo '</div>';
     }
 }
开发者ID:MinecraftServernet,项目名称:shoestrap-3,代码行数:31,代码来源:class-Shoestrap_Jumbotron.php

示例12: evision_corporate_sidebar

    /**
     * Sidebar
     *
     * @since eVision Corporate 1.0.0
     *
     * @param null
     * @return null
     *
     */
    function evision_corporate_sidebar()
    {
        global $evision_corporate_customizer_all_values;
        if (isset($evision_corporate_customizer_all_values['evision-corporate-layout-page'])) {
            $evision_corporate_layout_page = $evision_corporate_customizer_all_values['evision-corporate-layout-page'];
            if ('sidebar-no' == $evision_corporate_layout_page) {
                $evision_corporate_sidebar_active = 0;
            } else {
                $evision_corporate_sidebar_active = 1;
            }
        } else {
            $evision_corporate_sidebar_active = 1;
        }
        if (!is_active_sidebar('sidebar-1') || 0 == $evision_corporate_sidebar_active) {
            return;
        }
        ?>

    <div id="secondary" class="widget-area" role="complementary">
        <?php 
        dynamic_sidebar('sidebar-1');
        ?>
    </div><!-- #secondary -->
<?php 
    }
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:34,代码来源:sidebar.php

示例13: sharp_dynamic_sidebar

 function sharp_dynamic_sidebar($widgetname)
 {
     dynamic_sidebar($widgetname);
     if (get_option('sharp_widget') == 1 and current_user_can('manage_options')) {
         echo '<span class="widgetmapname">' . $widgetname . '</span>';
     }
 }
开发者ID:wpmonty,项目名称:skinny,代码行数:7,代码来源:misc-functions.php

示例14: widget

 function widget($args, $instance)
 {
     global $it_storage_cache_layout_settings, $builder_current_sidebar;
     global $wp_registered_sidebars;
     if (in_array($instance['sidebar'], $builder_current_sidebar)) {
         return;
     }
     list($module_guid, $num) = explode('-', $instance['sidebar']);
     $layout = null;
     foreach ((array) $it_storage_cache_layout_settings['layouts'] as $layout_id => $layout_data) {
         foreach ((array) $layout_data['modules'] as $module) {
             if ($module['guid'] === $module_guid) {
                 $layout = $layout_id;
                 break 2;
             }
         }
     }
     if (!is_null($layout)) {
         global $builder_current_sidebar;
         do_action('builder_sidebar_register_layout_sidebars', $layout);
         if (!is_array($builder_current_sidebar)) {
             $builder_current_sidebar = array();
         }
         $builder_current_sidebar[] = $instance['sidebar'];
         dynamic_sidebar($instance['sidebar']);
         array_pop($builder_current_sidebar);
     }
 }
开发者ID:jimrucinski,项目名称:Vine,代码行数:28,代码来源:widget.php

示例15: get_dynamic_sidebar

function get_dynamic_sidebar($index = 1)
{
    ob_start();
    dynamic_sidebar($index);
    $sidebar_contents = ob_get_clean();
    return $sidebar_contents;
}
开发者ID:superhero,项目名称:wp-facade-foundation,代码行数:7,代码来源:functions.php


注:本文中的dynamic_sidebar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。