function wma_sidebar($atts = array()) { //Set default setting attributes $atts = wp_parse_args($atts, array('attributes' => '', 'class' => 'widget-area', 'max_widgets_count' => 0, 'sidebar' => 'sidebar-1', 'tag' => 'div', 'wrapper' => array('open' => '', 'close' => ''))); //Helper variables $output = ''; //Validation //class $atts['class'] = trim('wm-sidebar ' . trim($atts['class'])); //max_widgets_count $atts['max_widgets_count'] = absint($atts['max_widgets_count']); //sidebar $atts['sidebar'] = trim($atts['sidebar']); if (!$atts['sidebar']) { $atts['sidebar'] = 'sidebar-1'; } //widgets setup $atts['widgets'] = wp_get_sidebars_widgets(); if (!is_array($atts['widgets'])) { $atts['widgets'] = array(); } if (isset($atts['widgets'][$atts['sidebar']])) { $atts['widgets'] = $atts['widgets'][$atts['sidebar']]; $atts['class'] .= ' widgets-count-' . count($atts['widgets']); } else { $atts['widgets'] = array(); } //wrapper if (!is_array($atts['wrapper']) && !isset($atts['wrapper']['open']) && !isset($atts['wrapper']['close'])) { $atts['wrapper'] = array('open' => '', 'close' => ''); } //class $atts['class'] = apply_filters('wmhook_wmamp_' . 'sidebar_classes', $atts['class']); $atts['class'] = apply_filters('wmhook_wmamp_' . 'sidebar_classes_' . $atts['sidebar'], $atts['class']); //tag if (in_array('sidebar', explode(' ', $atts['class']))) { $atts['tag'] = 'aside'; } //Allow filtering the attributes $atts = apply_filters('wmhook_wmamp_' . 'sidebar_atts', $atts); $atts = apply_filters('wmhook_wmamp_' . 'sidebar_atts_' . $atts['sidebar'], $atts); //Preparing output if (is_active_sidebar($atts['sidebar']) && (0 === $atts['max_widgets_count'] || $atts['max_widgets_count'] >= count($atts['widgets']))) { $output .= $atts['wrapper']['open']; if (function_exists('wmhook_sidebars_before')) { $output .= wmhook_sidebars_before(); } $output .= "\r\n\r\n" . '<' . tag_escape($atts['tag']) . ' class="' . $atts['class'] . '" data-id="' . $atts['sidebar'] . '" data-widgets-count="' . count($atts['widgets']) . '"' . $atts['attributes'] . '>' . "\r\n"; //data-id is to prevent double ID attributes on the website $output .= apply_filters('wmhook_wmamp_' . 'sidebar_widgets_pre', '', $atts); if (function_exists('wmhook_sidebar_top')) { $output .= wmhook_sidebar_top(); } if (function_exists('ob_start') && function_exists('ob_get_clean')) { ob_start(); dynamic_sidebar($atts['sidebar']); $output .= ob_get_clean(); } if (function_exists('wmhook_sidebar_bottom')) { $output .= wmhook_sidebar_bottom(); } $output .= apply_filters('wmhook_wmamp_' . 'sidebar_widgets_post', '', $atts); $output .= "\r\n" . '</' . tag_escape($atts['tag']) . '>' . "\r\n\r\n"; if (function_exists('wmhook_sidebars_after')) { $output .= wmhook_sidebars_after(); } $output .= $atts['wrapper']['close']; } //Output $output = apply_filters('wmhook_wmamp_' . 'sidebar', $output, $atts); $output = apply_filters('wmhook_wmamp_' . 'sidebar_' . $atts['sidebar'], $output, $atts); return apply_filters('wmhook_wmamp_' . 'wma_sidebar' . '_output', $output, $atts); }
* Helper variables */ $sidebar_id = 'footer-widgets'; $widgets_count = wp_get_sidebars_widgets(); if (is_array($widgets_count) && isset($widgets_count[$sidebar_id])) { $widgets_count = $widgets_count[$sidebar_id]; } else { $widgets_count = array(); } /** * Output */ echo '<div class="footer-widgets clearfix columns-4 masonry-disabled" data-columns="4"><div class="wrap-inner"><div class="pane twelve">'; echo wmhook_sidebars_before(); echo "\r\n\r\n" . '<div class="wm-sidebar widget-area footer-widgets-container widgets-count-' . count($widgets_count) . '" data-id="' . $sidebar_id . '" data-widgets-count="' . count($widgets_count) . '">' . "\r\n"; echo wmhook_sidebar_top(); if (is_active_sidebar($sidebar_id)) { dynamic_sidebar($sidebar_id); } else { echo ' <div class="widget width-1-2" style="width: 48%;"> <h3 class="widget-heading">About Mustang Lite</h3> <div class="widget-content"> <strong>Mustang Lite</strong> WordPress Theme lets you create beautiful, professional business websites. By default you get the basic blog design which can be extended to full power of the theme with additional <a href="http://wordpress.org/plugins/webman-amplifier/" target="_blank"><strong>WebMan Amplifier</strong> plugin installation</a> (see the <a href="http://themedemos.webmandesign.eu/mustang/">full theme demo website</a>). This theme is a free, lite version of premium <a href="https://creativemarket.com/webmandesign/45467-Mustang-Multipurpose-WordPress-Theme?ref=mustang-lite" target="_blank"><strong>Mustang Multipurpose WordPress Theme</strong> by WebMan</a>. The lite version <strong>does not</strong> support WooCommerce eshop plugin, bbPress forums plugin and also does not contain the premium page builder and sliders plugins included in the paid version. Check out themes by WebMan at <a href="http://www.webmandesign.eu">www.webmandesign.eu</a>. Thank you for using Mustang Lite!<br /><br /> Theme user manual with demo data can be found at <a href="http://www.webmandesign.eu/manual/mustang/">www.webmandesign.eu/manual/mustang/</a>. </div> </div> <div class="widget"> <h3 class="widget-heading">Footer Widgets</h3> <div class="widget-content">