• Hello!

    I am new to the WordPress world and have been trying to implement custom sidebars for all my staff pages. I thought I had it figured out, but I realized today that in all browsers, the sidebars are only showing up if I’m logged into my WordPress account and can edit my pages.

    I made a new sidebar PHP file named “sidebar-professionals.php”, and then in my single-professionals.php page, I directed the sidebar to that file with the code:
    <?php get_sidebar(‘professionals’); ?>

    It was seemingly working fine, until I realized people not logged in don’t see any sidebar at all!

    Do I need do fix my code? I’ve seen posts talking about “registering” sidebars, but I am extremely confused by this. I would appreciate any help. Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I see a sidebar on that page. See https://i.imgur.com/6svaicA.png

    Your site uses “Endurance Page Cache”. When developing, it’s important to disable all caching plugins or… you won’t necessarily see the results of your changes. Once done, re-enable caching.

    Thread Starter khaynes014

    (@khaynes014)

    Sorry, I have been playing around with it since then and trying different options. Still would like to know how to fix the above though. Haven’t stuck gold on these other tutorials.
    I just un-did what I have been playing around with and it’s back to only showing when logged in.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Have you added any widget(s) to that sidebar? If you copied a sidebar.php file, it usually has a call to is_active_sidebar(), which won’t display it if there’s no content.

    Thread Starter khaynes014

    (@khaynes014)

    Yes, my sidebar-professionals.php file has that call in it.
    I don’t have any widgets added, as the content I’m trying to add is being pulled from custom fields in my custom post type, so I thought this was all PHP code. I’m not sure where to go to add widgets through my dashboard, I’ve been trying to add all my information through the code in sidebar-professionals.php

    Am I going about this incorrectly?

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    APPEARANCE=>WIDGETS

    Drop in a text widget and type “hello” into it. See if that causes teh sidebar to display.

    Thread Starter khaynes014

    (@khaynes014)

    I just added that to the sidebar-left which is where ultimately I want this sidebar to go, BUT this sidebar is called “professionals” and not sidebar-left, no? Nothing happened on the pages, still no sidebar if you’re not logged in.
    There was no professionals option in the widgets menu. Do I need to add this somewhere?

    What I find strange is that I’m seeing it fine when I’m logged in.
    https://imgur.com/a/gsfPtcS

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Did you create a sidebar called “professionals” via register_sidebar()?

    Thread Starter khaynes014

    (@khaynes014)

    No, I haven’t registered the sidebar, I wasn’t following the tutorials and wasn’t sure where to put the code.
    Do I put it in my sidebar-professionals.php file, or somewhere else? And can you point me to a correct snipbit of code to add. Thank you Steve I really appreciate your help

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Thread Starter khaynes014

    (@khaynes014)

    Thank you Steve, I think I have it almost perfect. I would just like to move it to the left side. Is there a code I can add to the functions code that will put it on the left?

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I’d start by playing with floats.

    Learn to use the Chrome Developer Tools or Firefox Developer Tools to help you see and test changes to your CSS.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Sidebar Only Showing When Logged In?’ is closed to new replies.