WordPress.org

Forums

[resolved] Sidebar on single.php (34 posts)

  1. JCKnoell
    Member
    Posted 1 year ago #

    Okay, so there are a thousand posts just like this one, but I don't understand any of them, and even though I've tried them anyway, they've had no effect or they've completely broken my site. (even broke the back-end on one of them. Had to use my ftp to fix it.)

    I need to add my blog's sidebar to my single post pages too. My blog's <http://beta.cleantelligent.com/blog> sidebar is different from the many other sidebars on my website, but I need the blog sidebar on the single posts. Right now, it's calling a blank sidebar.

    Thank you. any help would be great.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    What theme are you using? Where did you download it from?

  3. JCKnoell
    Member
    Posted 1 year ago #

    Sorry, forgot to put that. It's the Twenty Eleven Theme with a customized child theme.

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    You should just be able to add <?php get_sidebar(); ?> to your child theme's single.php file. Then you will probably need to start adding in some custom CSS to sort out the sidebar display on that page.

  5. JCKnoell
    Member
    Posted 1 year ago #

    I already added the "get sidebar" php and now it's only calling a blank sidebar with the images from two other sidebars... randomly...

    If you look in the upper-left corner, you'll see two gradients.
    http://beta.cleantelligent.com/best-practices/accountability-in-the-workplace#more-1794

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    it's only calling a blank sidebar with the images from two other sidebars

    What 2 other sidebars? There's only one sidebar in the parent theme. And what exactly are you adding to single.php?

  7. JCKnoell
    Member
    Posted 1 year ago #

    I added <?php get_sidebar(); ?> in the correct place (above the footer call) in my single.php.

    Now, if you look at a single post, the only thing you see where the sidebar should be are two little gradient images we use to blend the sidebar into the background of the html div.

    One of them is blue, and is the gradient used on sidebar-blog.php. This is the sidebar for the blog. You can see it by visiting http://www.cleantelligent.com/blog.

    The other one is a grey gradient and it used on the reat of the website. You can see this sidebar on any other page, such at http://www.cleantelligent.com/request-demo.

    All of the sidebars are located in the child theme, as far as I know.

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    I added <?php get_sidebar(); ?> in the correct place (above the footer call) in my single.php.

    That should work. Can you remove the other 2 sidebars from your child theme temporarily?

  9. JCKnoell
    Member
    Posted 1 year ago #

    remove them? How would I remove them temporarily?

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    Take them out of the child theme's folder.

  11. JCKnoell
    Member
    Posted 1 year ago #

    Done... whoah... something's weird... haha

  12. esmi
    Forum Moderator
    Posted 1 year ago #

    What happened?

  13. JCKnoell
    Member
    Posted 1 year ago #

    It's now showing a weird sidebar with items I've never even seen before... http://beta.cleantelligent.com/best-practices/accountability-in-the-workplace

  14. JCKnoell
    Member
    Posted 1 year ago #

    Okay, so I have <?php get_sidebar(); ?>
    Should I be specifying the blog sidebar there?

    Like <?php get_sidebar('blog'); ?> for example?

  15. esmi
    Forum Moderator
    Posted 1 year ago #

    Are you running any custom queries/loops in your child theme?

  16. JCKnoell
    Member
    Posted 1 year ago #

    Hmm... I don't know what that means... :S Sorry.

  17. esmi
    Forum Moderator
    Posted 1 year ago #

    Should I be specifying the blog sidebar there?

    Not based on the parent theme, no. The sidebar that is pulled into the main posts page template (index.php) is sidebar.php. So <?php get_sidebar(); ?> should, in theory, be all that you need. How many sidebar files do you have and what are they called?

  18. esmi
    Forum Moderator
    Posted 1 year ago #

    OK - can you list the files in your child theme's root folder?

  19. JCKnoell
    Member
    Posted 1 year ago #

    content-archive.php
    content-benefits.php
    content-blog.php
    content-page.php
    content-pricing.php
    content-webinar.php
    content-webinarArchive.php
    content.php
    Footer
    (footer.php)
    form.php
    Theme Functions
    (functions.php)
    Header
    (header.php)
    Main Index Template
    (index.php)
    Page Template
    (page.php)
    sidebar-blog.php
    sidebar-footer.php
    single-webinar-archives.php
    Single Post
    (single.php)
    About Page Template
    (t-about.php)
    Benefits Page Template
    (t-benefits.php)
    Home Template Page Template
    (t-home.php)
    Plans and Pricing Page Template
    (t-pricing.php)
    Tour Page Template
    (t-tour.php)
    Webinars-Archive Page Template
    (t-web-old.php)
    Webinars Page Template
    (t-webinars.php)
    taxonomy-webinar-categories.php

    Styles

    Stylesheet
    (style.css)
    ie.css

  20. esmi
    Forum Moderator
    Posted 1 year ago #

    That's your child theme!?

  21. JCKnoell
    Member
    Posted 1 year ago #

    yes... I didn't write it. This is part of the reason the former designer was fired. :)

  22. esmi
    Forum Moderator
    Posted 1 year ago #

    I do not envy you trying to sort this one out. It looks as if it's pretty much a complete custom theme! Looks like there is a sidebar-blog.php in the theme, so try adding <?php get_sidebar( 'blog' );?> to single.php and see if that works.

  23. JCKnoell
    Member
    Posted 1 year ago #

    hmm... nope, just back to the random gradient images..

    Yeah, It's been a pain in the... head, to say the least. I appreciate your empathy. :)

  24. esmi
    Forum Moderator
    Posted 1 year ago #

    Can you drop a copy of the single.php and functions.php files into the pastebin and post the pastebin urls here?

  25. JCKnoell
    Member
    Posted 1 year ago #

    http://pastebin.com/UWLDnw7q
    http://pastebin.com/ZCGE0RUX

    Thank you very much for your help. :) You seem to always be the best responder on this forum. You deserve some sort of award. :)

  26. esmi
    Forum Moderator
    Posted 1 year ago #

    There's definitely some dubious stuff going on in this theme. :-( For example, wp_enqueue_script('jquery'); in my_admin_init() (functions.php). why is jQuery being enqueued when it's loaded by default by WP. You might want to comment that line out in case jQuery is being loaded twice in the back end of the site.

    Then there's whole block of js in clean_meta_boxes() (functions.php) that should have been enqueued rather than just dropped into the function "as is". Again, that could be causing problems.

    single.php looks pretty straightforward (albeit rather messy). However, it seems to be calling content-archive.php - another custom template file. Can you drop that into the pastebin?

  27. JCKnoell
    Member
    Posted 1 year ago #

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<div class="webinar-archive-content entry-content">
    		<?php the_content(); ?>
    	</div><!-- .entry-content -->
    	<footer class="entry-meta">
    		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
    
    	</footer><!-- .entry-meta -->
    </article><!-- #post-<?php the_ID(); ?> -->

    Is all that's in content-archive.php

    So, comment out those two things listed above?

  28. esmi
    Forum Moderator
    Posted 1 year ago #

    Is all that's in content-archive.php

    Well, at least that looks OK.

    comment out those two things listed above?

    Try commenting out the first issue I mentioned (the enqueueing of jquery) and then check eveything ion the back &front end of the site to see if anything broke as a result.

    The second issue - all that js in functions.php - is going to be really difficult to pull out. It seems to be related to some sort of special back end functionality (meta boxes for Posts & Pages?) with clean_meta_boxes() being called by clean_show_meta_box() which in turn is called by clean_add_box(). Change any part of these functions and you'll probably break this special back end functionality.

    How much freedom do you have to play with this theme? Is it on a live site or just a test site?

  29. JCKnoell
    Member
    Posted 1 year ago #

    It's more or less live. Haha, it's a long story. Short version is that beta is on a database which pushes out to the live site. The live site is cached, so I normally have time to make changes on beta before it goes live, but it's not as reliable as a normal stage development should ideally be.

    Anyway, I'll make that first change regarding the enqueueing.
    As for the second part, I have no idea what that is. I'll ask around and see if anyone else knows.

  30. JCKnoell
    Member
    Posted 1 year ago #

    so am I just commenting out /*wp_enqueue_script('jquery');*/

    or should I do the entire paragraph?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags