• Resolved omgayush

    (@omgayush)


    Hello Everyone.

    I have the latest version of WordPress and whenever I’m googling about this, I find replies that have good response of working, but I don’t configure it out how. I think I can do this via PHP Code Widget, but that seems a fail for me too. Those replies were 5-6 years ago, so taking the WordPress versions in mind, I’d rather not follow those.

    Can anyone please tell me how to show a particular sidebar for registered users only, and view the sidebar or any particular para?

    I am NOT a coder or expert in any form :p Just here to learn, I’d love to get explained by some experts out here!

    Cheers,
    Ayush

Viewing 3 replies - 1 through 3 (of 3 total)
  • Locate functions.php in your active theme folder and add the bellow code in it.

    if ( function_exists('register_sidebar') )
        register_sidebar( array(
       'name' => __( 'My Custom Widget Area - 1'),
       'id' => 'mycustomwidgetarea',
       'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
       'before_widget' => '<aside id="%1$s" class="widget %2$s">',
       'after_widget' => "</aside>",
       'before_title' => '<h3 class="widget-title">',
       'after_title' => '</h3>',
       ) );

    Add this to place you want to show it.

    <?php
    if ( is_user_logged_in() ) {
    <?php
     // Custom widget Area Start
     if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('My Custom Widget Area - 1') ) : ?>
    <?php endif;
    // Custom widget Area End
    ?>
    <?php endif; ?>
    } else { ?>
    <?php
    };
    ?>
    Thread Starter omgayush

    (@omgayush)

    Sorry, I have fixed my issue with a very simple plugin! But anyway, thank you for your support buddy – appreciate it!

    The plugin is called Private Content and it’s free.. I searched “Private” on WordPress plugin area and installed it on my website.

    Here’s the link of the developer:
    https://dev.aldolat.it/projects/private-content/

    It works like charm on posts, sidebars and pages. May it be guest or member. And yep, I’m not a promoter or something, but I love this plugin now ??

    You should try to avoid plugins when you can.

    I have about 20 plugins, even I coded everything that I could find way to (without plugin).

    Easier to backup, easier to restore, if you do not have many plugins.

    Also more plugins means slower wordpress site, and there is the possibility of conflict between plugins.

    And many, many other reasons.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sidebar that is restricted to Registered Users only’ is closed to new replies.