diff --git a/modules/sportspress-widget-alignment.php b/modules/sportspress-widget-alignment.php index 67948adf..6df29bf7 100644 --- a/modules/sportspress-widget-alignment.php +++ b/modules/sportspress-widget-alignment.php @@ -39,9 +39,12 @@ class SportsPress_Widget_Alignment { // Widgets add_filter( 'sportspress_widget_update', array( $this, 'widget_update' ), 10, 2 ); add_filter( 'sportspress_widget_defaults', array( $this, 'widget_defaults' ) ); + add_filter( 'sportspress_shortcode_wrapper', array( $this, 'shortcode_wrapper' ), 10, 3 ); add_action( 'sportspress_before_widget_template_form', array( $this, 'before_widget_form' ), 10, 2 ); add_action( 'sportspress_before_widget', array( $this, 'before_widget'), 10, 2 ); add_action( 'sportspress_after_widget', array( $this, 'after_widget') ); + add_action( 'sportspress_ajax_shortcode_form', array( $this, 'ajax_shortcode_form' ) ); + add_action( 'sportspress_ajax_scripts_before_shortcode', array( $this, 'ajax_scripts' ) ); } /** @@ -85,6 +88,17 @@ class SportsPress_Widget_Alignment { return $defaults; } + /** + * Shortcode wrapper + */ + function shortcode_wrapper( $wrapper = array(), $function = null, $atts = array() ) { + if ( isset( $atts['align'] ) ) { + $wrapper['class'] = sp_array_value( $wrapper, 'class', '' ) . ' ' . 'sp-widget-align-' . $atts['align']; + } + + return $wrapper; + } + /** * Before widget forms */ @@ -116,6 +130,35 @@ class SportsPress_Widget_Alignment { function after_widget() { echo ''; } + + /** + * Ajax shortcode form + */ + function ajax_shortcode_form() { + ?> +
+ +
+ + args.align = $div.find('[name=align]').val(); +