The SiteOrigin Widgets Bundle is one of my favorite plugins, not only because it has a bundle of widgets, but also because it is very extendable and allows other developers to customize and add more features to each widget. Moreover the guys of Siteorigin also provide a guide on how to extend the plugin (see https://siteorigin.com/docs/widgets-bundle/)
Recently I wanted to use the slider of the SiteOrigin Widgets Bundle but I also wanted to be able to hide a frame or two – not deleted, which is the default option if you don’t want to display them anymore. Hiding and not deleting frames is a useful feature when you have frames for special occasions and don’t want to recreate them each time you need them.
The only thing needed is a checkbox “Hide this frame” into the frame’s tab, which then should be “be respected” by the rendering function of the slider, so the specific frame won’t be displayed.

So the addition of this extra functionality in the SiteOrigin slider turn out to be very easy.
All you have to do is to add the following code into your theme’s functions.php file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * | |
| * @param array $form_options | |
| * @param type $widget | |
| * @return array | |
| */ | |
| function ls_extend_sow_slider_form_add_hide_frame($form_options, $widget) { | |
| $form_options['frames']['fields']['hide_frame'] = array('type' => 'checkbox', | |
| 'label' => __('Hide this frame', 'so-widgets-bundle'), | |
| 'default' => false,); | |
| return $form_options; | |
| } | |
| add_filter('siteorigin_widgets_form_options_sow-slider', 'ls_extend_sow_slider_form_add_hide_frame', 10, 2); | |
| /** | |
| * | |
| * @param type $instance | |
| * @param type $args | |
| * @return array | |
| */ | |
| function ls_slider_hide_the_hidden_frame($instance, $args) { | |
| $frames = empty($instance['frames']) ? array() : $instance['frames']; | |
| if (!empty($frames)) { | |
| foreach ($frames as $i => $frame) { | |
| if ($frame['hide_frame']) { | |
| unset($frames[$i]); | |
| } | |
| } | |
| $frames=array_values($frames); | |
| foreach ($frames as &$frame) { | |
| $link_atts = array(); | |
| if (!empty($frame['new_window'])) { | |
| $link_atts['target'] = '_blank'; | |
| $link_atts['rel'] = 'noopener noreferrer'; | |
| } | |
| $frame['link_attributes'] = $link_atts; | |
| } | |
| } | |
| return array( | |
| 'controls' => $instance['controls'], | |
| 'frames' => $frames, | |
| ); | |
| } | |
| add_filter('siteorigin_widgets_template_variables_sow-slider', 'ls_slider_hide_the_hidden_frame', 10, 2); |

I hope not to bother. but can you check group suggestion plugin for wordpress? 😡
LikeLike
that face was meant to be a concerned face … D:
LikeLike