• So, my sidebar is working just fine on my blog page: beta.cleantelligent.com/blog
    However, when you click a single post, I’d like that same sidebar to show up.

    I am assuming this would be under single.php, right? That code is listed below. Let me know if you need any other code and I’ll post it here.

    I have the ‘blog’ sidebar in my page attributes on the Edit Page in WordPress, but it’s just not being recognized by the template, I guess?

    Any help would be great. Thanks!

    <?php
    get_header(); ?>
    <div class=”blackbar”>
    <div class=’bbw’>
    Blog
    </div>
    </div>
    <div class=’cont-wrap’>

    <div id=”primary”>
    <?php
    $post_obj = $wp_query->get_queried_object();
    $post_name = $post_obj->post_name;
    if($post_name == ‘blog’){
    echo ‘Blog’;
    }else{
    $parent_title = get_the_title($post->post_parent);
    echo $parent_title;
    }
    ?>
    <div id=”content” role=”main”>

    <?php while ( have_posts() ) : the_post(); ?>

    <?php get_template_part( ‘content’, ‘archive’ ); ?>

    <?php endwhile; // end of the loop. ?>

    </div><!– #content –>
    </div><!– #primary –>
    <?php get_sidebar(); ?>
    </div>

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter JCKnoell

    (@jcknoell)

    If it helps, there’s been some additional discussion on this page:
    http://stackoverflow.com/questions/20640166/wordpress-sidebar-on-single-php

    You can see additional code there too.

    Thread Starter JCKnoell

    (@jcknoell)

    Has this post been buried or is everyone stumped? 🙂

    Thread Starter JCKnoell

    (@jcknoell)

    wow… this is a little bit out of my league… I am using a customized theme that was designed by someone else. Twenty Eleven is the parent, I believe.
    The get sidebar action is there… I get lost when it comes to the function.php

    Thread Starter JCKnoell

    (@jcknoell)

    I tried what the post said and it’s still not working… didn’t change anything anywhere on my site.

    Honestly, if you look at http://beta.cleantelligent.com/tour/work-order-software for example, the sidebar is working fine, but then on http://beta.cleantelligent.com/benefits/new-business-win-cleaning-bids which is using a direct copy of the exact same template, it’s not showing anything for a sidebar… Why does this have to be so complex? Haha

    Twenty Eleven is the parent, I believe.

    Yep, that’s why I posted that link 🙂

    I am using a customized theme that was designed by someone else.

    Have you asked whoever coded it? It’s generally quite difficult for people here to help with highly custom themes since we don’t know how they are coded.

    It actually looks like that sidebar is showing up on your single – try adding this CSS to see it:

    .left-sidebar #secondary {
      border: 1px solid red;
    }

    Have you gone through that linked article and compared what your site has to that?

    Thread Starter JCKnoell

    (@jcknoell)

    yeah I have… and nothing seemed to make any changes. There IS a sidebar showing up on my single posts, but it’s not loading the content from the sidebar. it should look exactly like it does on the main blog page. I want the exact same sidebar.

    I tired installing an extension plugin, and it worked in bringing a sidebar to http://beta.cleantelligent.com/benefits/new-business-win-cleaning-bids but it is not style properly, but if I try to style it, it changes the style on my tour pages… sigh…

    Also, I know exactly who coded it originally and I have been called in to clean up their messes on multiple occasions. I am convinced they are the worst web design company in the nation.

    I have been called in to clean up their messes on multiple occasions

    Ugh. Have you validated those pages – some serious mark-up issues…not sure they’re the cause of the sidebar problems but still…

    Thread Starter JCKnoell

    (@jcknoell)

    Yeah, I know. yes I have. the issues there are irreparable, as far as I know.

    I tired installing an extension plugin, and it worked in bringing a sidebar to http://beta.cleantelligent.com/benefits/new-business-win-cleaning-bids but it is not style properly, but if I try to style it, it changes the style on my tour pages… sigh…

    You should be able to target the CSS to certain pages/templates using more specific selectors? Or are there not any?

    Thread Starter JCKnoell

    (@jcknoell)

    I don’t know… :S can you explain?

    The body tags have classes you can use as CSS selectors – for example that page has:

    <body class="page page-id-45 page-child parent-pageid-699 page-template page-template-t-benefits-php single-author singular two-column left-sidebar">

    So use any of those classes (that are not in the tour pages) in the CSS – this would only target this one page:

    .page-id-45 other selectors... {
       styles;
    }

    Thread Starter JCKnoell

    (@jcknoell)

    so, I’ll be honest, I’ve never understood the big long classes that are in wordpress themes… I’ve only ever used short one-word or short phrases in my classes…

    do I just pick one of the words in there, or do I have to use the big long description?

    You need to use the class specific to the pages(s) you want to target. You can’t use a string of classes applied to the same element (basic CSS). Start looking at the body tag output for the pages you want to target vs. the ones you don’t want that CSS to apply to.

    Thread Starter JCKnoell

    (@jcknoell)

    Well, I fixed the benefits pages. Apparently I was missing the get sidebar call in that template after all…

    I’m still freaking out about the single post pages though…

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Sidebar on single.php’ is closed to new replies.