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; } } }
function whitepaper_template() { remove_action('thesis_hook_header', 'thesis_default_header'); add_action('thesis_hook_header', 'thesis_whitepaper_header'); get_header(apply_filters('thesis_get_header', $name)); echo '<div id="container">' . "\n"; echo '<div id="page">' . "\n"; thesis_header_area(); echo ' <div id="content_box">' . "\n"; thesis_content_column(); echo ' <div id="sidebars">' . "\n"; echo ' <div id="sidebar_5 class="sidebar">' . "\n"; echo ' <ul class="sidebar_list">' . "\n"; dynamic_sidebar(5); echo ' </ul>' . "\n"; echo ' </div>' . "\n"; // sidebar_5 echo ' </div>' . "\n"; // //sidebars echo ' </div>' . "\n"; // content_box thesis_footer_area(); echo '</div>' . "\n"; //page echo '</div>' . "\n"; //container get_footer(apply_filters('thesis_get_footer', $name)); }
function mh_themes_wrapper_end() { ?> </div> <?php $options = mh_theme_options(); ?> <?php if ($options['sidebars'] != 'no') { ?> <aside class="mh-sidebar <?php mh_sb_class(); ?> "> <?php dynamic_sidebar('woocommerce'); ?> </aside> <?php } ?> </div> <?php mh_second_sb(); ?> </div> <?php }
/** * {@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"; }
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>'; } }
/** * 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 }
function howlthemes_foot() { ?> <footer id="colophon" class="site-footer" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter"> <div class="container"> <div class="three-column-footer"> <?php dynamic_sidebar('footer-1'); ?> </div> </div><!-- .site-info --> </footer><!-- #colophon --> <div class="copyright"> <div class="container"> <div class="copyright-text"> <?php _e('Designed By', 'aqueduct'); ?> <a href="http://www.howlthemes.com" target="blank" style="color:#efefef;text-decoration:none;">HowlThemes</a> </div> <div class="back-top"> <a href="#" id="back-to-top" title="Back to top"><?php _e('Back To Top', 'aqueduct'); ?> <i class="fa fa-arrow-circle-o-up"></i></a> </div> </div> </div> </div><!-- #page --> <?php }
/** * 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 }
function wise_dynamic_sidebar($index = 1, $options = array()) { global $wp_registered_sidebars; // Get the sidebar index the same way as the dynamic_sidebar() function if (is_int($index)) { $index = "sidebar-{$index}"; } else { $index = sanitize_title($index); foreach ((array) $wp_registered_sidebars as $key => $value) { if (sanitize_title($value['name']) == $index) { $index = $key; break; } } } // Bail if this sidebar doesn't exist if (empty($wp_registered_sidebars[$index])) { return false; } // Get the current sidebar options $sidebar = $wp_registered_sidebars[$index]; // Update the sidebar options $wp_registered_sidebars[$index] = wp_parse_args($options, $sidebar); // Display the sidebar $status = dynamic_sidebar($index); // Restore the original sidebar options $wp_registered_sidebars[$index] = $sidebar; return $status; }
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>'; } }
function synsite_wp_footer() { ?> <footer class="footer"> <ul class="sidebar"> <?php if (!dynamic_sidebar('sidebar-2')) { ?> <li> <?php if (has_nav_menu('social')) { ?> <h2 class="widgettitle"> <?php _e('Find us', 'synsite'); ?> </h2> <div class="textwidget"><?php wp_nav_menu(array('depth' => 1, 'container' => 'nav', 'fallback_cb' => false, 'theme_location' => 'social')); ?> </div> <?php } ?> </li> <?php } ?> </ul> <div class="clear"></div> </footer> <?php }
/** * 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))); }
function example_widget($content) { if (is_home() && is_active_sidebar('example') && is_main_query()) { dynamic_sidebar('example'); } return $content; }
/** * 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>'; } } }
function block($instance) { extract($instance); echo '<div class="widgetable">'; dynamic_sidebar($sidebar); echo '</div>'; }
function blog_sidebar() { if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Blog Sidebar')) { ?> <?php } }
function stachestack_footer_content() { global $ss_framework; // Finding the number of active widget sidebars $num_of_sidebars = 0; for ($i = 0; $i < 5; $i++) { $sidebar = 'sidebar-footer-' . $i; if (is_active_sidebar($sidebar)) { $num_of_sidebars++; } } // If sidebars exist, open row. if ($num_of_sidebars >= 0) { echo $ss_framework->open_row('div'); } // Showing the active sidebars for ($i = 0; $i < 5; $i++) { $sidebar = 'sidebar-footer-' . $i; if (is_active_sidebar($sidebar)) { // Setting each column width accordingly $col_class = 12 / $num_of_sidebars; echo $ss_framework->open_col('div', array('medium' => $col_class)); dynamic_sidebar($sidebar); echo $ss_framework->close_col('div'); } } // If sidebars exist, close row. if ($num_of_sidebars >= 0) { echo $ss_framework->close_row('div'); // add a clearfix div. echo $ss_framework->clearfix(); } do_action('stachestack_footer_html'); }
protected function content($atts, $content = null) { $output = $el_position = $title = $width = $el_class = $sidebar_id = ''; extract(shortcode_atts(array('el_position' => '', 'width' => '1/1', 'el_class' => '', 'sidebar_id' => ''), $atts)); if ($sidebar_id == '') { echo 'Sidebar ID not set.'; return null; } $el_class = $this->getExtraClass($el_class); ob_start(); dynamic_sidebar($sidebar_id); $sidebar_value = ob_get_contents(); ob_end_clean(); $sidebar_value = trim($sidebar_value); $sidebar_value = substr($sidebar_value, 0, 3) == '<li' ? '<ul>' . $sidebar_value . '</ul>' : $sidebar_value; // $el_class = $this->getExtraClass($el_class); $width = spb_translateColumnWidthToSpan($width); $output .= "\n\t" . '<div class="spb_sidebar_widget spb_content_element ' . $width . $el_class . '">'; $output .= "\n\t\t" . '<div class="spb_wrapper clearfix">'; $output .= "\n\t\t\t" . $sidebar_value; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.spb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment($width); $output = $this->startRow($el_position) . $output . $this->endRow($el_position); return $output; }
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>'; } }
/** * Add widget support for homepage. If no widgets active, display the default loop. * */ function magazine_home_loop_helper() { if (is_active_sidebar('home-top') || is_active_sidebar('home-left') || is_active_sidebar('home-right') || is_active_sidebar('home-bottom')) { if (is_active_sidebar('home-top')) { echo '<div class="home-top">'; dynamic_sidebar('home-top'); echo '</div><!-- end .home-top -->'; } if (is_active_sidebar('home-left') || is_active_sidebar('home-right')) { echo '<div class="home-middle">'; if (is_active_sidebar('home-left')) { echo '<div class="home-left">'; dynamic_sidebar('home-left'); echo '</div><!-- end .home-left -->'; } if (is_active_sidebar('home-right')) { echo '<div class="home-right">'; dynamic_sidebar('home-right'); echo '</div><!-- end .home-right -->'; } echo '</div><!-- end .home-middle -->'; } if (is_active_sidebar('home-bottom')) { echo '<div class="home-bottom">'; dynamic_sidebar('home-bottom'); echo '</div><!-- end .home-bottom -->'; } } else { genesis_standard_loop(); } }
/** * 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); }
function vanilla_widget_block_wrapper($block) { // called from within a dynamic PHPTAL macro (below) to stop it outputting a '1' to screen. if (!dynamic_sidebar($block)) { // do nothing; } }
/** * After content * @return void */ function basey_content_after_output() { ?> </div> <?php if (get_post_type(get_the_ID()) == 'post') { ?> <div class="uk-width-medium-3-10"> <div class="uk-panel uk-panel-box"> <?php dynamic_sidebar('basey-sidebar'); ?> </div> </div> <?php } ?> </div> </div> </section> <div id="offcanvas-menu" class="uk-offcanvas"> <div class="uk-offcanvas-bar uk-offcanvas-bar-flip"> <?php wp_nav_menu(array('menu' => 'primary', 'theme_location' => 'primary', 'depth' => 2, 'container' => '', 'menu_class' => 'uk-nav uk-nav-offcanvas uk-nav-parent-icon', 'items_wrap' => '<ul id="%1$s" class="%2$s" data-uk-nav>%3$s</ul>', 'fallback_cb' => 'basey_offcanvas_menu::fallback', 'walker' => new basey_offcanvas_menu())); ?> </div> </div> <?php }
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); } }
function widget($args) { global $wp_registered_widgets; extract($args); echo $before_widget; $widget_ids = wp_get_sidebars_widgets(); if (!empty($widget_ids['tabs-widget-area'])) { echo '<div class="tabs-section">'; $output = '<ul class="tabs-list">'; $i = 0; foreach ($widget_ids['tabs-widget-area'] as $widget) { $widget_object = $wp_registered_widgets[$widget]['callback'][0]; $widget_id = $wp_registered_widgets[$widget]['params'][0]['number']; $widget_data = get_option($widget_object->option_name); foreach ($widget_data as $id => $widget) { if ($id == $widget_id) { $i++; if ($i == 1) { $output .= '<li class="tabs-current">' . __($widget['title'], 'unspoken') . '</li>'; } else { $output .= '<li>' . __($widget['title'], 'unspoken') . '</li>'; } } } } echo $output .= '</ul>'; if (!dynamic_sidebar('tabs-widget-area')) { } echo '</div>'; } echo $after_widget; }
function get_dynamic_sidebar($index = 1) { ob_start(); dynamic_sidebar($index); $sidebar_contents = ob_get_clean(); return $sidebar_contents; }
public function wordpressAction(Request $request) { $this->get('wordpress.loader')->load(); $this->get('wordpress.loader')->loadPostInWordpressFromRequest($request); remove_theme_support('custom-header'); remove_action('wp_head', 'wp_enqueue_scripts', 1); remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'feed_links_extra', 3); remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); remove_action('wp_head', 'locale_stylesheet'); remove_action('wp_head', 'noindex', 1); remove_action('wp_head', 'wp_print_styles', 8); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'rel_canonical'); remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); ob_start(); @wp_head(); $head = ob_get_clean(); ob_start(); $content = dynamic_sidebar('sidebar-2'); $side = ob_get_clean(); ob_start(); the_content(); $content = ob_get_clean(); $post = array('content' => $content); return $this->render($this->container->getParameter('wordpress.template'), array('post' => $post)); }
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 }
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; }
/** * Displays the secondary widget area * Check if the widget area is active or if the default is set to home * If neither is true, don't display the XHTML * * @since 0.2.2 */ function hybrid_get_secondary() { global $hybrid_settings; if ($hybrid_settings['secondary_inserts_default'] && is_sidebar_active(__('Secondary Home', 'hybrid')) && !is_page_template('no-widgets.php') || is_sidebar_active(hybrid_secondary_var()) && !is_page_template('no-widgets.php')) { ?> <div id="secondary"> <?php hybrid_before_secondary(); // Before secondary hook if (dynamic_sidebar(hybrid_secondary_var())) { } else { if ($hybrid_settings['secondary_inserts_default']) { if (dynamic_sidebar(__('Secondary Home', 'hybrid'))) { } } } hybrid_after_secondary(); // After secondary hook ?> </div> <?php } }