Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to have one multi-column portfolio page but within each column or cell is a defined set of images for that particular category (or event)

I do not want to rotate through images and see ones from another cell or column

it would be like having multiple photo albums accessible on the same page.

I think this can be done using categories but I dont seem to be able to assign more than one category to a page and have the portfolio display each category as a separate set of images.

Thank you

share|improve this question

1 Answer 1

Generally speaking this should produce the structure you're looking for. It's 4 separate WP_query loops, and each loop pulls in posts from the category named.

 <div id="portfolio">

        <div class="col">
            <?php           
                $cat1 = new WP_query(array('category_name' => 'design'));

                if($cat1->have_posts()) :
                    while($cat1->have_posts()) : $cat1->the_post();
            ?>
            <div class="item">
                <?php
                     if(has_post_thumbnail())
                     {
                            the_post_thumbnail();
                     }
                ?>
            </div>
            <?php       
                  endwhile;
             endif;
            ?>
        </div>
        <!---------------------------------------------------------------->
        <div class="col">
            <?php           
                $cat2 = new WP_query(array('category_name' => 'development'));

                if($cat2->have_posts()) :
                    while($cat2->have_posts()) : $cat2->the_post();
            ?>
            <div class="item">
                <?php
                     if(has_post_thumbnail())
                     {
                            the_post_thumbnail();
                     }
                ?>
            </div>
            <?php       
                  endwhile;
             endif;
            ?>
        </div>
        <!---------------------------------------------------------------->
        <div class="col">
            <?php           
                $cat3 = new WP_query(array('category_name' => 'branding'));

                if($cat3->have_posts()) :
                    while($cat3->have_posts()) : $cat3->the_post();
            ?>
            <div class="item">
                <?php
                     if(has_post_thumbnail())
                     {
                            the_post_thumbnail();
                     }
                ?>
            </div>
            <?php       
                  endwhile;
             endif;
            ?>
        </div>
        <!---------------------------------------------------------------->
        <div class="col">
            <?php           
                $cat4 = new WP_query(array('category_name' => 'magazine'));

                if($cat4->have_posts()) :
                    while($cat4->have_posts()) : $cat4->the_post();
            ?>
            <div class="item">
                <?php
                     if(has_post_thumbnail())
                     {
                            the_post_thumbnail();
                     }
                ?>
            </div>
            <?php       
                  endwhile;
             endif;
            ?>
        </div>

 </div>
share|improve this answer
    
Hi Ben. With this code formatting is really hard to read. :) Maybe you want to improve the formatting slightly? Thanks. –  kaiser Sep 21 '12 at 10:49
1  
Thanks kaiser, I somehow missed that. –  Ben Sep 21 '12 at 18:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.