Support » Fixing WordPress » Dynamic Sidebar on Single posts

  • I have a dynamic sidebar which appears on my Main Blog Posts and on all Pages on my site: http://rhiannonpaine.com

    However, when I view either a Recent Post (single) or one of the Archives posts, the dynamic sidebar content disappears. I would like the dynamic sidebar to appear at all times on every type of post view. I’m guessing that I need to put some code for the dynamic sidebar in my Single.php template but I know so little about PHP that I don’t know where to put it, or if I’m even correct about the edit/change needing to be in Single.php.

    I’ve uploaded the Single.php content into the pastebin.

    Could someone please help me understand

    1) whether Single.php is the right place to add code to link to the dynamic sidebar content to fix the missing sidebar problem
    2) where I should place the missing code and what should that code be?

    Many thanks for any help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Since there’s a call to the sidebar in your single.php template file (get_sidebar()), I’d suggest you try looking in sidebar.php.

    Thread Starter tortuga

    (@tortuga)

    Thanks for the quick response esmi!

    I’ve pasted the Sidebar in the pastebin for perusal but the call to the dynamic sidebar is already in it.

    The dynamic sidebar does show up on the main blog posts and in the other Pages on the website. It just doesn’t show up when you click on a Recent Post or an Archives link. What would be causing that difference?

    From your sidebar file:

    <?php if (is_home() || is_page()) {?>
     <ul>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    Which, roughly translated, says “if this is the main blog page page or a static page, then show the widgets”.

    I’ve amended the file so that it should display the widgets on all pages. The amended file is available at http://wordpress.pastebin.com/PWSgvWJK

    Please back up your current sidebar.php file before copying in this new version – just in case I’ve misinterpreted what you wanted.

    Thread Starter tortuga

    (@tortuga)

    Thanks esmi. Unfortunately the new code didn’t make any difference. The sidebar appears on the main blog and static pages but not on the Archived or Recent Post pages. Any other ideas? I really do appreciate the help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dynamic Sidebar on Single posts’ is closed to new replies.