need query help

Discussion in 'WordPress' started by sixrfan, Mar 18, 2011.

  1. #1
    this is a little over my head but i'm trying to work through it.

    if you look at http://shirtsaboutnothing.com/wordpress/categories-page/">this page you'll see that's its pulling in the pictures and titles from the different posts.

    i'm using the code here to make it happen: http://pastebin.com/zJmiieDv along with this css:
    .project-box-1 {float:left; padding-left:0; width:300px;}
    .project-box {float:left; padding-left:29px; width:300px;}
    Code (markup):
    the problem i have is when there's more than 3 posts, the first one that appears in the second row has the attributes of project box, but i want it to have the attributes of .project-box-1.

    how do i alter my code so that the first item and every 3 after that have .project-box-1 assigned to them???

    please advise. thanks!
     
    sixrfan, Mar 18, 2011 IP
  2. sixrfan

    sixrfan Well-Known Member

    Messages:
    354
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    sixrfan, Mar 18, 2011 IP
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    <div id="recent-projects">  
    	<?php	
    		$count = 1;
    		$recentblog = new WP_Query();
    		$recentblog->query("category_name=parent-category");
    	?>
    	<?php if ($recentblog->have_posts()) : while ($recentblog->have_posts()) : $recentblog->the_post(); ?>
    		<?php if ($count == 1) : ?>
    			<div class="project-box-1">
    		<?php else : ?>
    			<div class="project-box">
    		<?php endif; ?>
    		<a href="<?php the_permalink(); ?>"><img src="<?php $thumb = get_post_custom_values('portfolio-image'); echo $thumb[0]; ?>" alt="<?php the_title(); ?>" />
    		<h4><?php the_title(); ?></h4></a>                 	
    		</div>
    		<?php $count++; if ($count > 3) count = 1; ?>
    	<?php endwhile; endif; ?> 
    <!--end recent-projects--></div>
    
    Code (markup):
    Hope that works, I have not tested it yet :)
     
    Cash Nebula, Mar 18, 2011 IP
  4. sixrfan

    sixrfan Well-Known Member

    Messages:
    354
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #4
    thanks cash. what i have in the pastebin file above seems to work so i'm gonna go with that. appreciate the effort.
     
    sixrfan, Mar 18, 2011 IP
  5. sixrfan

    sixrfan Well-Known Member

    Messages:
    354
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #5
    actually, now i'm having trouble with the code thats in place: http://pastebin.com/Lj8hPnGy

    if you look on the page you'll notice that it only shows 10 images. No matter how many more i add, it wont show more than 10.

    please advise how i get it to display all of them. thanks in advance.
     
    sixrfan, Mar 20, 2011 IP
  6. sixrfan

    sixrfan Well-Known Member

    Messages:
    354
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #6
    nevermind. i had to change my reading settings, which was stuck on 10.
     
    sixrfan, Mar 20, 2011 IP