Restrict Widgets


Restrict Widgets

Take full control over your widgets! Select on which pages each widget will appear on, who can manage widgets and which widgets and sidebars users can use.

Restrict Widgets is all in one solution for widget management in WordPress. It gives every widget an extra control fields that lets you control the pages that the widget will appear on. This plugin creates a new “manage_widgets” capability, that allows you to gives access to widgets page to selected WordPress user roles. You can also set which sidebars and widgets will be available to selected users, which widget options will be available and how it will be displayed.

By default, ‘Hide widget on selected’ is enabled with no options selected, so all current widgets will continue to display on all pages.

Features include:

  • Hide or display each widget on selected pages, posts, categories, custom taxonomies, custom post types, single posts, archives, special pages, for logged in or logged out users, current language and so on
  • Restrict Users – select which user roles are restricted to manage widgets
  • Restrict Sidebars – select which sidebars will be restricted to admins only
  • Restrict Widgets – select which widgets will be restricted to admins only
  • Restrict Widget Options – select which widget options will be restricted to admins only
  • Restrict Option Groups – chose to display or not widget options as groups
  • WPML compatibility
  • Polylang compatibility
  • .pot file for translations included
  • 1.3.0
  • Option to enter post ID's where widget should be displayed/hidden - http://www.dfactory.eu/support/topic/single-default-custom-post-types/
  • Fields overlapping JS bug
  • Option to select "post" post type only
  • Call to undefined function bbp_is_search()
  • PHP Warnings for array_keys() and in_array() on Multisite install
  • Create separate menu for Restrict Widget settings
  • 1.2.0
  • Multisite compatibility
  • Add bbPress options - search and user profiles
  • get_class() error
  • Add option for mobile devices
  • 1.1.0
  • Widget options not saving if no options selected (since 1.0.1)
  • Add hooks to display / hide widget based on custom conditions
  • Restricting on user_logged_in/out doesn't work
  • Show on selected not working
  • 1.0.0
  • Inital release

Leave a Reply

Your email address will not be published. Required fields are marked *

32 comments on "Restrict Widgets"

  1. in this link >>> http://www.dfactory.eu/support/ ?????

    • Bartosz

      Yes, exactly. You’ll find a RW support forum there.

  2. I use version 1.2.3 and have problem when i set to hide widget on laptop or desktop. When i open my website on laptop the widget still run.

    I was change setting to “Display widget on selected ” >>> mobile but if i open in laptop/desktop that widget still run..

    I Use the latest version WordPress.

    • Bartosz

      Please post this in a plugin dedicated support forum.

  3. Hi,
    in my site i need to restrict widget for category page. Plugin work properly only after editing the file restrict-widgets.php in this way:

    ….
    elseif(is_page()) {
    $found_main = isset($instance['rw_opt']['pageid_'.$post_id]) ? TRUE : FALSE;

    /* FM */
    $post = $wp_query->post;
    $categs= get_the_category( $post->ID );
    $categ = $categs[0];
    $catprop = ‘category_’.$categ->term_id;

    if (isset($instance['rw_opt'][$catprop])) {
    $found_main = isset($instance['rw_opt'][$catprop]) ? TRUE : FALSE;
    }
    }
    elseif(is_singular())
    {
    $found_main = isset($instance['rw_opt']['cpt_'.get_post_type($post_id)]) ? TRUE : FALSE;

    if(is_single() && $found_main == FALSE)
    $found_main = isset($instance['rw_opt']['others_single_post']) ? TRUE : FALSE;

    /* FM */
    $post = $wp_query->post;
    $categs= get_the_category( $post->ID );
    $categ = $categs[0];
    $catprop = ‘category_’.$categ->term_id;

    if (isset($instance['rw_opt'][$catprop])) {
    $found_main = isset($instance['rw_opt'][$catprop]) ? TRUE : FALSE;
    }
    }
    elseif(is_category()) {
    /* FM */
    //$found_main = isset($instance['rw_opt']['category_'.get_query_var('cat')]) ? TRUE : FALSE;
    $post = $wp_query->post;
    $categs= get_the_category( $post->ID );
    $categ = $categs[0];
    $catprop = ‘category_’.$categ->term_id;
    $found_main = isset($instance['rw_opt'][$catprop]) ? TRUE : FALSE;
    }

    otherwise the widgets were not filtered.
    Federico

  4. Hello. I cannot figure how to get a widget to ONLY show on ONE SPECIFIC Post (as opposed to Page)…. the dropdown menu in the widgets screen only lists published Pages, not published Posts

  5. Hi. I had been using the plugin for a few months with no problems. After upgrade to v1.2.0, nothing works on the widget page. Can’t drag widgets to the sidebars, or open any widgets on the sidebar to set “hide/show.” Would like this to work because it’s a great plugin.
    Thanks,
    Larry

    • Bartosz

      Larry, please post this as a support topic – we’ll need some more details.

      • Thanks, Bartosz. I opened a topic about it in the support section.
        Larry

  6. Hi, was wondering if you had a timeline for when this excellent-sounding plugin will work with WP multi-site. I really don’t see much reason to have a plugin installed that restricts user access to site widgets if they don’t even have access to them, anyway. I mean, blog visitors don’t have access to an admin’s control panel, anyway. So it seems to me that the natural use for this plugin WOULD BE to control user access to plugins on a multi-site platform.

    As such, it seems really strange to me that it isn’t yet multi-site compatible.

    Would you be able to give an indication of when this plugin will be compatible with multi-site? I have a bit of time yet before my site goes live and if it will be ready by then, I’d like to use this plugin. If it’s not ready by then, I should start looking for something compatible now, I’m afraid.

    Best,
    Darren.

    • Bartosz

      Don’t worry – upcoming update will include multisite support.

      • Hi Bartosz,

        Thanks for the reply. What I was wondering, though, is if you have a DATE for the next release, then, so that I can determine whether I can wait for this plugin’s next version or if I’ll have to find something else because the new update won’t be ready until after I launch my website.

        I’m trying to determine a timeline of events so that I can determine if I can build the site with the components I WANT or whether I’ll have to use components that are not necessarily ideal.

        So that is why I’m trying to figure out a DATE (or at least a proposed time period, like “last week of December” or something) for when it will become available for multisite.

        If you could provide this info, I would be very grateful because then I’ll know if I can wait for the next version of this plugin or whether I’ll have to find something else…

        Best
        Darren
        (ps. and thanks for your help – again)

    • Bartosz

      It will be released this week.

  7. Other widget logic plugins break your head or break your site. This one: neither!

    Simple, intuitive, excellent plugin.

    Denis

    • Bartosz

      Thanks Denis. FYI: new features are coming

  8. Really awesome plugin – so far it works perfectly :-)

    Keep up the good work!!

    Regards
    Nick

    • Bartosz

      Thank you Nick :)

  9. I am trying to restrict certain widgets only to admin, but its not letting me to do it… It displays the widget even to Non Admins.. Please Help Me Out…

    • Bartosz

      Rajbir, you definitely can achieve that. Just use rw_display_widget() filter, adjusting the method described in this post: http://www.dfactory.eu/support/topic/restrict-widget-to-post/

  10. having some problems with this widget.

    I’m running a multi site network, new users who create a site on the network are super admins, but when i activiate this plugin, the widget menu disspears all together.

    Why is that? I need users to be able to edit widgets

    • Bartosz

      Gilad, Restrict Widgets is not multisite compatible yet. We’ll be working on it in one of the future releases.

      • I see. Too bad, it’s exactly what i’m looking for.

        Thank you

  11. Bartosz

    Ok SImon.
    Update to the just released version 1.1.1

    Then add this to your functions.php and adjust according to your needs:


    function custom_rw_display_widget ($display, $instance) {
    if (is_category() && $instance['title'] == 'Your widget title') { // change Your widget title
    $display = true; // or false if you want to hide it
    }
    return $display;
    }
    add_filter('rw_display_widget', 'custom_rw_display_widget', 10, 2);

    And please post your support questions to our Support forum.

  12. Hi,

    I have now received and updated your widget plugin….thank you, however, I am still having the same issue when trying to only show my widget under all ‘category’ pages. If I add show widget under ‘store’ this seems to work but if I only want my widget showing under /category/* then the widget disappears?

    Can you please help with this issue?

    Regards

    Simon

  13. Hi,
    How soon will this bug fix be released as when trying to show my widget on only category pages it doesn’t work?

    • Bartosz

      Good timing Simon – it was just uploaded to the repository.

  14. Bartosz

    Thank you Attila. We’ll be releasing a bugfix for RW shortly.

  15. Reading Jenny’s comment, I had the same problem, but the fix I wrote in my previous comment will solve it.
    Cheers,
    Attila

  16. Hi, this is a fine plugin, but I had to fix a small bug in the display_frontend_widgets function. The problem was that, when using WPML the language checking was always processed, even there was no any selection in the options. This caused malfuctioning. Here is the quick fix, but you may find better way:

    if(function_exists(‘icl_get_languages’) || function_exists(‘pll_the_languages’))
    {
    // check, if there is any language specific settings
    $needtocheck = 0;
    foreach($instance['rw_opt'] as $key=>$value)
    {
    if(strstr($key, ‘language_’))
    {
    $needtocheck = 1;
    break;
    }
    }

    if($needtocheck)
    {
    … the rest of the code for this block

    Cheers,
    Attila

  17. Bartosz

    Sounds like a bug – added to our To-do list.

  18. Hi there,

    This seems like an awesome plugin, but I’m having trouble getting it to work. Restricting user roles doesn’t interest me – I just want to be able to have certain widgets (menus mostly) appear (or not) on certain pages to avoid oodles of templates and sidebars. Seems to work if I choose the “hide” option, but not the “show” option. Although I can proceed using “hide” – will be much more tedious to maintain as there are more pages to hide for each condition.

    Looking forward to future updates.
    cheers,
    -jennyb

  • 490 322 sites are already using dFactory plugins. Is yours?

    Stay in touch

    Enter your email to receive updates when new posts or plugins are published. (No spam, we promise.)

    Join the Site

    Get instant access to our free support forum.

    Sign up