Support » Plugin: Easy Widget Columns » Plugin Won’t Work.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Alexis J. Villegas

    (@ajvillegas)

    Souvik,

    Thank you for you feedback. I installed the Prasoon theme, and I think I know why it doesn’t work.

    But first, just to clear things up, are you able to save data onto a widget? For example, if you add the Search widget and update the title, does it save your change when you click “Save”? I ask, because if the widget data is not being save to the database, there might be another issue altogether.

    With that said, I did notice a couple of incompatibility issues with the Prasoon theme. The first is with the way Prasoon registers sidebars. There are two sidebars registered by the theme, the “Sidebar” widget area, and the “Business Template” widget area. The first sidebar is registered correctly with a before_widget and after_widget parameters, but the second sidebar (Business Template) doesn’t specify those parameters and are left empty (please refer to the functions.php file and take a look at the prasoon_widgets_init function starting in line 134).

    As stated on my plugin FAQs “This plugin only works with registered sidebars that have an HTML element assigned to the before_widget and after_widget parameters. If these parameters are empty, the plugin will not work. In addition, the before_widget parameter must have a class attribute associated with it so the plugin can inject the column classes accordingly.”

    The second compatibility issue is with the way all Prasoon widgets are registered. None of them echo the $before_widget and $after_widget parameters in their markup. So even if you fix the sidebar registration function (see below), the Prasoon widgets are still not using them in their markup so you still wouldn’t get the columns classes assigned to those specific widgets.

    To accomplish your original task, you could edit the prasoon_widgets_init function, but will have to use widgets that output the $before_widget and $after_widget parameters in their markup such as the WordPress default widgets, or other third-party widgets that make use of those parameters since the Prasoon widgets are incompatible.

    Here is the amended prasoon_widgets_init function:

    /**
     * Register widget area.
     *
     * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
     */
    if ( ! function_exists( 'prasoon_widgets_init' ) ) :
    function prasoon_widgets_init() {
        register_sidebar( array(
            'name'          => esc_html__( 'Sidebar', 'prasoon' ),
            'id'            => 'main-sidebar',
            'description'   => esc_html__( 'Add widgets here.', 'prasoon' ),
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget'  => '</aside>',
            'before_title'  => '<h4 class="widget-title">',
            'after_title'   => '</h4>',
        ) );
    
        register_sidebar( array(
            'name'          => esc_html__( 'Business Template.', 'prasoon' ),
            'id'            => 'business-sidebar',
            'description'   => '',
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget'  => '</aside>',
            'before_title'  => '',
            'after_title'   => '',
        ) );
    }
    endif;
    add_action( 'widgets_init', 'prasoon_widgets_init' );

    For more information registering sidebars, please refer to this page: Registering a Sidebar.

    I hope this can help you solve your original problem.

    Cheers.

    Thread Starter Souvik

    (@adventuretalesofall)

    Hey Alexis,
    Thank you for the elaboration.
    As you mentioned at the very first, I am unable to save widget, and that’s where the problem is taking place.

    So, what’s the easiest solution, I wanted to know.
    Thanks!!

    Plugin Author Alexis J. Villegas

    (@ajvillegas)

    Hi Souvik,

    Unfortunately there could be many things causing the widgets not saving to the database error. I have the Prasoon theme installed with Easy Widget Columns and everything is saving fine on my end, so it tells me it might not be a theme issue, but rather a conflict with another plugin.

    Are you able to save plugins again if you deactivate Easy Widgets Columns? Try deactivating all plugins except for Easy Widget Columns and see if the problem still persists. If it works as expected, then start reactivating the other plugins one by one testing the widgets every time until it breaks again. If you can pinpoint the conflicting plugin, please send me the name so I can try to replicate the issue and see if I can find a fix.

    Thank you.

    Plugin Author Alexis J. Villegas

    (@ajvillegas)

    Hi Souvik,

    Another user recently had a similar problem to yours and I was able to find a bug with the widget update callback filter which was short-circuiting the widget’s ability to save their settings in some server environments mainly those running PHP 7.

    I issued an update that should fix the problem in version 1.2.1 of the plugin. Could you please update and confirm if the issue is fixed?

    Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin Won’t Work.’ is closed to new replies.