This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Widget causing Javascript Conflicts in editor

Open general
10 years ago

Hi all!

I’m developing a plugin for my client that allows them very simply insert a Metaslider slideshow into the layout. I know they could quite easily insert the shortcode into a visual editor but I wanted to make it just that bit quicker and easier to just drop a new widget in and select the slideshow from a dropdown.

I’ve created the widget/plugin and it all works as it should but it seems to be causing issues when loading the Page Builder in the admin. I sometimes have to refresh the page a few times for Page Builder to load correctly and visual editors to work, hence why I believe it’s down to a javascript conflict.

Here’s the plugin:


class monio_widget_metaslider extends WP_Widget {
function monio_widget_metaslider(){
parent::WP_Widget(false, $name = '[Monio] Metaslider', array('description'=>__('Displays a Metaslider', 'text_domain'), 'panels_icon' => 'dashicons dashicons-images-alt2' ) );
}
function widget($args, $instance){
extract($args);
$slider = intval($instance['metaslider']);
if($slider>0){
echo do_shortcode('[metaslider id='.$slider.']');
}
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['metaslider'] = intval($new_instance['metaslider']);
return $instance;
}
function form($instance){
$metaslider = intval($instance['metaslider']);
$options = array('post_type'=>'ml-slider','posts_per_page'=>-1);
$the_query = new WP_Query($options);
?>

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Have a different question or issue?

Start New Thread