Support » Fixing WordPress » Really, really, really messed up sidebar.

  • Okay so I made a sidebar and used jQuery to make it work how I wanted. It all works fine… Except for one thing… If I insert the code I use to get the most popular posts it completely screws up the sidebar, somehow mimicing the entire website. I have no idea why on earth it’s doing do but it’s awful and I haven’t a clue how to fix it.

    The site in question is: you’ll see what I mean when you look.

    the code being used is:

    <?php $popular_posts = $wpdb->get_results("SELECT id,post_title FROM {$wpdb->prefix}posts ORDER BY comment_count DESC LIMIT 0,5);
          foreach($popular_posts as $post) {
                print "<li><a href='". get_permalink($post->id) ."'>".$post->post_title."</a>\n";

    I’ve checked if it’s definitly the code and it is – when I commented it out everything was fine. Also I had to type that code out by hand on an iPhone because my internets died so if the code has any errors in it it’ll just be a typo, unless it’s something obviously wrong.

    please reply as this is a very annoying problem and one I have no idea how to fix. Any help is appriciated, Alex.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Really could use some help please 🙁

    I decided to take the script off for the time being. Here’s a pic of the problem though: again *any* help or advice is helpful. I really want to get it sorted :p


    *gets on knees and begs* I’ve literally tried EVERYTHING. It’s the Javascript as well but I’m too much of a n00b to fix it. No I’m not being a whiney b*tch, I just want/need it fixed >_<

    The jQuery which is also offending, just in case it helps… Although I’m guessing no one knows how to fix this issue? :S

    $('#explore_widget > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });

    Moderator Mark Ratledge


    Forum Moderator

    Validate your page; you have missing </div> tags. That should fix the display problems, regardless of the jQuery scripts.

    EDIT: Nope, sorted all the errors out – Still being weird :/

    if I comment the PHP script out… it’s fine… if I comment the js out… it’s fine. Are the two things somehow clashing and if so – why?

    Another strange thing is, if I view source, everything is as it should be… :S

    If I take two of the three sections out, no error. Strangeeee…

    Moderator Mark Ratledge


    Forum Moderator

    Don’t know….

    If your side bar has defualt widgets in it eg categories, links, calender etc.

    Then you must add content to it only after the <?php endif; ?> line

    other wise you are trying to embed into the default content and you will disrupt the syntax or roder of the default html code

    checked your site, not sure what i’m looking for , seems fine other than some empty advertisements

    Yeah I’ve fixed it now, I have no idea how, few code changes and pop! All better… strange :S

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Really, really, really messed up sidebar.’ is closed to new replies.