Grow your CSS skills. Land your dream job.

[Solved] Sidebar Does Weird Things on Page 2

  • # March 9, 2010 at 11:24 am

    hiya,

    My website looks fine on the front page, but when you go to the second page, the sidebar decides to fly out to the right! it looks like it’s outside of the page wrap for some reason, although as far as i am aware it should be fine as it’s all in the index.php!

    what i am guessing, is that it has something to do with the if statement i am running… it checks to see if it’s the first page. if it is, then it shows a featured post and displays it. then runs the normal loop. but something seems to go wrong on page 2 etc…

    this is my site http://allthebestvids.com/

    and the code for the index.php is below.

    If you could help me with this then i will think that you are a pretty swell guy!

    Code:
    < ?php get_header(); ?>

    < ?php
    if ( !is_paged() ) :
    // check if this not a paged page of posts, then show featured post
    ?>

    < ?php $my_query = new WP_Query('category_name=featured&posts_per_page=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;?>

    ” rel=”bookmark” title=”Permanent Link to < ?php the_title_attribute(); ?>“> < ?php the_title(); ?>

    < ?php the_content('Read The Article / Have your say!'); ?>

    < ?php echo get_post_meta($post->ID, ‘video’, true);?>

    < ?php endwhile; ?>

    < ?php endif; // end of if( !is_paged() ) condition, end of featured post
    ?>

    < ?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    < ?php the_time('d') ?>

    < ?php the_time('M') ?>

    < ?php the_time('Y') ?>

    ” rel=”bookmark” title=”Permanent Link to < ?php the_title_attribute(); ?>“> < ?php the_title(); ?>



    < ?php echo get_post_meta($post->ID, ‘image’, true);?>
    < ?php the_content('Watch The Video / Have your say!'); ?>

    < ?php the_tags('Tags: ', ', ', '
    ‘); ?> Posted in < ?php the_category(', ') ?> | < ?php edit_post_link('Edit', '', ' | '); ?> < ?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>


    < ?php endwhile; ?>

    • < ?php next_posts_link('« Older Entries') ?>
    • < ?php previous_posts_link('Newer Entries »') ?>

    < ?php else : ?>

    Not Found

    Sorry, but you are looking for something that isn’t here.

    < ?php include (TEMPLATEPATH . "/searchform.php"); ?>

    < ?php endif; ?>

    < ?php get_sidebar(); ?>


    < ?php get_footer(); ?>

    # March 9, 2010 at 12:56 pm

    It could be that your enclosing <div class="loop"> is only in the first loop and not the second. You might consider moving this outside of any loops so that all your posts are enclosed within it.

    Code:
    // loop 1

    // loop 2

    # March 10, 2010 at 8:06 am

    hey man!

    thanks for that dude! it’s sorted now, i was being lame with div tags again! thanks for your help mate :)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".