WordPress.org

Ready to get started?Download WordPress

Forums

Really, really, really messed up sidebar. (13 posts)

  1. alexrogahn
    Member
    Posted 4 years ago #

    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: http://tutshelf.com 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.

  2. alexrogahn
    Member
    Posted 4 years ago #

    Really could use some help please :(

  3. alexrogahn
    Member
    Posted 4 years ago #

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

  4. alexrogahn
    Member
    Posted 4 years ago #

    Bump.

  5. alexrogahn
    Member
    Posted 4 years ago #

    *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 >_<

  6. alexrogahn
    Member
    Posted 4 years ago #

    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' } });

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

  8. alexrogahn
    Member
    Posted 4 years ago #

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

  9. alexrogahn
    Member
    Posted 4 years ago #

    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...

  10. Don't know....

  11. turbulence
    Member
    Posted 4 years ago #

    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

  12. turbulence
    Member
    Posted 4 years ago #

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

  13. alexrogahn
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic