Give help. Get help.

  • # December 4, 2009 at 12:25 am

    Hey, Im really confused.
    So I have multiple single.php templates and there are synced up to different category archive pages via the main single.php.
    Thats all good and dandy. Im using this technique:
    I ran into a problem, all the post the_title and the_content tags are grabbing the info from my fist post in its category.
    ie I have 3 posts under the portfolio category, the first one looks right, but the last 2 posts are grabbing the title and content info from the first post… Everything else like the wp_title and the custom fields i have are all pulling from the appropriate post.

    So whats the deal?? I’m cant figure this one out. Here is the single-blog.php file.

    < ?php get_header(); ?>


    < ?php the_title(); ?>

    < ?php the_content(); ?>

    < ?php get_footer(); ?>

    # December 4, 2009 at 12:41 am

    whoa there. So first you do this for your sidebar:

    < ?php query_posts('cat=4&showposts=10'); ?>

    That line of code overwrites the "default" query for that page…. so it will always show cat 4 max posts = 10

    You need to reset the "Loop" back to what it should be for that page. I believe this is the code for that:

    < ?php wp_reset_query(); ?>

    Let me know if that does the trick

    (another way to handle it is to have the sidebar list display after the main content (in the html), and use CSS to make sure it’s placed in the right spot.)

    # December 4, 2009 at 1:48 am

    HOO-RAH! You are brilliant! I used the latter suggestion and it worked liked a charm. Thanks so much!

    # December 4, 2009 at 1:49 am


    Did you try the <?php wp_reset_query(); ?> ?

    I forget if that’s the right query…


    # December 4, 2009 at 1:59 am

    I just tried it, both ways worked perfectly. i think this is the 2nd post of mine you answered in this forum. Thanks again!! :D

    # December 4, 2009 at 2:15 am

    Excellent. You’re welcome.
    Thanks for answering my post ;)

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

You must be logged in to reply to this topic.