VERY QUICK php/Wordpress fix needed!

Discussion in 'Programming' started by roknrolltkovr, Oct 6, 2008.

  1. #1
    Hey guys, I have a VERY, VERY simple problem that I can't for the life of me figure out! What I want is on my home page on my WP blog, to show posts as excerpts in two identical, parallel vertical columns, but only posts from CATEGORY 3. Everything works, but I can't figure out how to work in the code to show excerpts from only category 3. Here are the two pieces of code, I just want to integrate these so it all works together.

    I'll paypal whoever can complete this (only if it works!) $5 right now. Either post back here or PM me with the code and your paypal email and I'll send the money right away. Gonna be here for the next few hours. Thanks!

    <?php
       if (is_home()) {
          query_posts("cat=3");
       }
    ?>
    Code (markup):

    <?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) == 0) : $wp_query->next_post(); else : the_post(); ?>
    
    <div id="left-column">
    <?php the_excerpt(); ?>
    </div>
    
    <?php endif; endwhile; else: ?>
    <div>Alternate content</div>
    <?php endif; ?>
    
    <?php $i = 0; rewind_posts(); ?>
    <?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) !== 0) : $wp_query->next_post(); else : the_post(); ?>
    
    <div id="right-column">
    <?php the_excerpt(); ?>
    </div>
    
    <?php endif; endwhile; else: ?>
    <div>Alternate content</div>
    <?php endif; ?>
    Code (markup):
     
    roknrolltkovr, Oct 6, 2008 IP
  2. Anthony Iacono

    Anthony Iacono Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    I think I can figure it out, if you could send a more complete description to I will help you out.
     
    Anthony Iacono, Oct 6, 2008 IP
  3. Fracisc

    Fracisc Well-Known Member

    Messages:
    3,670
    Likes Received:
    10
    Best Answers:
    1
    Trophy Points:
    195
    As Seller:
    100% - 1
    As Buyer:
    50.0% - 1
    #3
    Try this:

    <?php if (have_posts()) :query_posts($query_string .'&cat=3'); while(have_posts()) : $i++; if(($i % 2) == 0) : $wp_query->next_post(); else : the_post(); ?>
    Code (markup):
    PM me if you still need help.
     
    Fracisc, Oct 7, 2008 IP