treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpess Loop Help

  • I've been working on a wordpress post loop. I have it set to show 12 items and then show the Next/Previous buttons. Can anyone help?

    I also wanted to try to figure out how to add a banner that spans 100% after 6 items have been show.

    <?php query_posts('category_name=Portfolio'); ?>
                    <?php if ( have_posts() ) : ?>
                      <?php $i = 1; while (have_posts() && $i < 12) : the_post(); ?>
                        <?php if($i == 1) {?><div class="row"> <?php } ?>
                <div class="col col_1_3">
                  <!-- <img src="<?php the_post_th// umbnail();?>" alt="<?php // post_title(); ?>" /> -->
                  <div class="port-img-border"><?php the_post_thumbnail();?></div>
                          <h6 class="portfolio-title"><?php the_title(); ?></h6>
                          <div class="port-buttons">
                            <?php if(get_post_meta($post->ID, 'Website_URL', true)) { ?>
                              <a class="view" href="<?php echo get_post_meta($post->ID, 'Website_URL', true) ?>" target="_blank"><em data-icon="("></em><span>Link 1</span></a>
                            <?php } ?>
                            <a class="view" href="<?php the_permalink(); ?>"><em data-icon="G"></em> <span>Link 2</span></a>
                          </div>
                </div>
                <?php if($i == 3) { ?></div><? } ?>
              <?php $i++; endwhile; ?>
              <p><?php next_posts_link(); ?></p>
              <p><?php previous_posts_link(); ?></p>
            <?php else : ?>
              <h1>Not Found</h1>
              <p>Silly monkey.</p>
            <?php endif; ?>