-3

The sidebar isn't appearing on my site: http://richardclunan.com/

I have a Text widget in the sidebar, with some test text in it…

In 'Edit Page', there's no 'no sidebar' option…

What things might I need to do to get the sidebar to appear?

(I might have it so nothing appears in the sidebar area at all – just have it activated to shunt the text of the main area on the page across, so the line length is shorter – I'm mentioning this just in case it's not possible to have it activated and have nothing appear...)

Edit: I'm adding a couple of questions in response to an answer:

  1. The word 'register_sidebar' appears in functions.php – does this mean dynamic sidebar support is enabled?

  2. do i add the code SimonDowdles gave only to one file? Or to both page.php and single.php?

  3. Where within the code on, say page.php, do i add the code SimonDowles gave?

  4. Should i create a child theme for this change I want to make? If yes, what process do i follow to do this?

  5. Do I replace the phrase 'id-of-desired-sidebar' from SimonDowdles code with the name of my sidebar? Where do I get the name from? In the Widgets section, there's a sidebar thing called 'Home Widgets' – is that the name I use? Hyphenated?

4
  • Although I have given you a solution below, I have assumed that you know enough about WordPress themes to implement that. You say that there is no 'no sidebar' option on the page edit screens. There does not have to be, this is theme specific as determined by the theme author. It is possible that (for some reason) they have disabled sidebars on the page template(s). If that is the case, you can quite easily add them to those template. Shout if thats the case, more than willing to help. Feb 10, 2013 at 22:34
  • Does the sidebar appear under Appearance->Widgets? That is where it would display instead of "Edit Page" Feb 10, 2013 at 22:35
  • @RachelBaker - The sidebar may very well appear under widgets but not be enabled in certain theme files, I think that is where the issue is. Richard said that he has a text widget in the sidebar, so I am assuming he can see the sidebar in the widgets page. Feb 10, 2013 at 22:37
  • What Theme are you using? Feb 10, 2013 at 22:41

2 Answers 2

2

@Richard,

To answer your questions in their order:

1) Yes, it means dynamic sidebar(s) are supported

2) You add the code to whichever page files / templates you want the sidebar to render in

3) The sidebar will render EXACTLY where you place the code

4) You do not have to create a child theme, up to you, more on child themes here: http://codex.wordpress.org/Child_Themes

5) Yes, you replace my phrase with the identifier used when the register_sidebar or register_sidebars method was called in your functions.php file (it will be the value of the 'id' key in the array). You can read up on sidebars here: http://codex.wordpress.org/Function_Reference/register_sidebar

Regards, Simon

0

Have you for starters enabled dynamic sidebar support in your theme by adding the necessary functions to your functions.php file? Notably the register_sidebar or register_sidebars functions.

If you have, then in your page template(s) such as page.php, single.php, etc etc you would call the sidebar or add alternative content, an example could be:

<?php
if(function_exists('dynamic_sidebar') && dynamic_sidebar('id-of-desired-sidebar')):
     // Nothing to do really, the call to dynamic_sidebar in the if condition would have already loaded the necessary sidebar content...
else:
     // Show alternative content here... or create necessary HTML to maintain right column...
endif;
?>

Have I understood you correctly?

[edit] As @ChipBennett quite rightly pointed out below, you can drop the function_exists() part of the above as the dynamic_sidebar function was added many versions ago. An updated code block would be as follows:

<?php
if(dynamic_sidebar('id-of-desired-sidebar')):
     // Nothing to do really, the call to dynamic_sidebar in the if condition would have already loaded the necessary sidebar content...
else:
     // Show alternative content here... or create necessary HTML to maintain right column...
endif;
?>
6
  • 1
    Note: you can drop the function_exists( 'dynamic_sidebar' ) conitional. That function was added to core about 3 years (and 6 major WordPress versions) ago. Feb 10, 2013 at 22:42
  • @ChipBennett While I agree with you for the most part, I don't believe you can put a timeline on legacy user support. That being said, I am used to adding this because the themes I create are distributed widely, and you never know what your user base is working with. Valid point though, agreed and will update. Feb 10, 2013 at 22:47
  • I think you are actively doing users a disservice by supporting a version of WordPress more than three years old, and more than six major versions out-of-date, considering the functional improvements and - more importantly - security improvements introduced in that time. Feb 11, 2013 at 2:23
  • thanks. i've added some clarification questions in the original post. i don't know a lot of tech stuff – my questions are about pretty basic things...
    – Richard
    Feb 11, 2013 at 2:24
  • @ChipBennett Maybe so, but that's on par with gas stations around the world saying they will no longer provide fuel services for cars older than 20 years because they're likely to be a road hazard. You'll be surprised how often users (and companies) are stranded with an older version (for now) of WordPress for whatever reason, be it a custom legacy plugin that is not supported in newer versions, or be it that their server will not support the newer versions (god knows why). Of course if I could change the world one WordPress installation at a time, I would... Feb 11, 2013 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.