Give help. Get help.

  • # October 15, 2009 at 2:10 am

    Hi, I know I’m new to this forum, but I’m even NEWER to coding in php/wordpress…

    I’m using one of chris’ snippets specifically the embed a page inside of a page in wordpress:

    < ?php $recent = new WP_Query("page_id=**ID**"); while($recent->have_posts()) : $recent->the_post();?>

    < ?php the_title(); ?>

    < ?php the_content(); ?>
    < ?php endwhile; ?>

    I’m using it as an editable sidebar so the client can easily add logo thumbnails to that little section

    the snippet works great, except that when I paginate a section of my site (which is actually a clients site) the second page of the pagination appears in the sidebar instead of the correct page: (Click on page 2 and you will understand).

    here is what my code looks like:


    < ?php /** * @package WordPress * @subpackage Default_Theme */ get_header(); ?>

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

    < ?php wp_link_pages(array('before' => ‘

    Pages: ‘, ‘after’ => ‘

    ‘, ‘next_or_number’ => ‘number’)); ?>
    < ?php the_content('

    Read the rest of this page »‘); ?>

    < ?php wp_link_pages(array('before' => ‘

    Pages: ‘, ‘after’ => ‘

    ‘, ‘next_or_number’ => ‘number’)); ?>

    < ?php endwhile; endif; ?>
    < ?php edit_post_link('Edit this entry.', '

    ‘, ‘‘); ?>

    < ?php get_footer(); ?>


    < ?php $recent = new WP_Query("page_id=574"); while($recent->have_posts()) : $recent->the_post();?>
    < ?php the_content(); ?>
    < ?php endwhile; ?>
    2033 Monroe Dr NE Atlanta, GA 30324 – (404) 892-2359

    < ?php /* "Just what do you think you're doing Dave?" */ ?>

    < ?php wp_footer(); ?>

    I think it has something to do with the location of the end of my loop… but I don’t know enough about php yet to properly trouble shoot. Can someone please help me?


# October 15, 2009 at 4:40 am

I suggest you try setting the sidebar query to always use page 1 by overriding the paged variable:

$recent = new WP_Query(“page_id=574&paged=1”);

Please give this a try and let me know if that solves it – since I can’t test it myself at the moment.


# October 15, 2009 at 8:35 am

Hi, Thank you for the reply!

I tried what you suggested, but it did not work.

could it be that this bit of code is outside of the ‘loop’?


# October 15, 2009 at 9:56 am

Ok, I figured it out…

I just moved the div thats floating right above the div thats floating left so that it was before the loop…

Thanks for all of the help!

(I’m still learning so bear with me!)

-Krylo :D

# October 15, 2009 at 9:58 am

OK, I followed your ‘test’ link again and it seems to be working from my point of view. The ‘Our Locations’ bar shows on all 3 pages of now instead of just on the first page.

Was there some other part of the problem that I didn’t see?


# October 15, 2009 at 10:06 am

well I think (as I’m not entirely sure) that it was because the snippet code wasn’t within the loop… so since it was two divs one floating right (the our locations), and one floating left (the main content). I just put the right floating div on top of the floating left div putting it before the loop…

I’m not sure WHY it worked… but so far it seems to have worked… maybe someone can help explain it to me?

and thanks again for your replies dave! :D


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

You must be logged in to reply to this topic.