• Resolved pinkhare

    (@pinkhare)


    Hi, very nice plugin!
    Today, I need to make this plugin to deactivate the other plugins automatically, when I activate a plugin. I don’t want to enable to select multiple plugins, because of their left or right margin issue (that happens when one sub-menu item becomes two or more menu-widgets) & id-based unique styling for each menu-widgets. So I wish that I could make the other widgets but selected one deactivated so that only one widget is activated.

    |||| || ||
    ^two widgets in one sub-item (“margin-left: 4px” styling needed, but it has no consistency when increased mega-menu columns)

    https://www.ads-software.com/plugins/menubar-widgets/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hadi khosrojerdi

    (@rss_samuel)

    I’m Sorry, But I can’t to understand what’s your mean. Please describe by screenshot’s.

    Also you can to review this plugin, if you like. ??

    Thread Starter pinkhare

    (@pinkhare)

    Currently, this plugin allows me to activate any number of widgets per one sub item. But I want to activate only one widget per one sub item. That is, I hope when I select 3 widgets and click the save button, then only the first widget is activated. If I need 2 or more, then I could create two or more sub-menu items, not many different widgets in one sub-menu item. I want ‘1:1’, not ‘1:n’ (1: sub-menu item, n: widgets).

    Thread Starter pinkhare

    (@pinkhare)

    Thread Starter pinkhare

    (@pinkhare)

    There’s a few more problems in this way that I didn’t write down on my screen shot(li elements consist of ‘menu-item’s & ‘menubar-widget’s, and they have no consistency for styling).

    It seems that I could resolve this issue by editing or adding some pieces of code around here:

    switch( $action ) {

    case “activate-selected”:

    // here, I want to slice selected widgets array for activating, so as to pass only the first widget element in widgets array. However, I cannot write appropriate & right code for you. Please teach me! ??

    Plugin Author Hadi khosrojerdi

    (@rss_samuel)

    I don’t want to enable to select multiple plugins, because of their left or right margin issue.

    The menubar widgets plugin doesn’t add any css or js code to front end, so maybe problem is from another plugins or current theme.

    There is one question for me on your screen shot, how you add “<li id=”menu-item-6800″ >” under “<ul id=”sub-menu menubar-widgets …” tag ?!

    If you want styling “menu-item-6800” and not “menubar-widget” items you can to use this css code for styling your columns.

    ul.menubar-widgets li:not(.menubar-widget) {
     /* your code */
    }

    However if you want slice and overwrite selected widgets you can to use this hooks.

    menubar_widgets_activate-selected

    menubar_widgets_update-selected

    for example :

    function my_func( $received_widgets, $menu_id, $item_id, $args ){
      $received_widget = array_shift( $received_widgets );
      update_post_meta( $item_id, '_menubar_widgets', $received_widget );
    }
    add_action("menubar_widgets_activate-selected", "my_func", 10, 4 );
    add_action("menubar_widgets_update-selected", "my_func", 10, 4 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How could I make it to deactivate the other widgets?’ is closed to new replies.