Advertisement
viktormorales

WordPress: Contenido en dos columnas

Oct 3rd, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.     // columna 1
  3.     $args = array("posts_per_page" => 5);
  4.     query_posts($args);
  5.     if (have_posts()) {
  6.     ?>
  7.         <div style="float: left; width: 200px;">
  8.             <?php while (have_posts()) { the_post(); $do_not_duplicate[] = $post->ID; ?>
  9.            
  10.                 <div>
  11.                     <h2><?php the_title(); ?></h2>
  12.                     <div class="the_excerpt"><?php the_excerpt(); ?></div>
  13.                 </div>
  14.            
  15.             <?php } ?>
  16.         </div>
  17.     <?php } ?>
  18.    
  19.     <?php
  20.     // columna 2
  21.     $args = array("posts_per_page" => 5, "post__not_in" => $do_not_duplicate);
  22.     query_posts($args);
  23.     if (have_posts()) { $i = 0;
  24.     ?>
  25.         <div style="float: right; width: 200px;">
  26.             <?php while (have_posts()) { the_post(); if (in_array($post->ID, $do_not_duplicate)) continue;  ?>
  27.                
  28.                 <div>
  29.                     <h2><?php the_title(); ?></h2>
  30.                     <div class="the_excerpt"><?php the_excerpt(); ?></div>
  31.                 </div>
  32.            
  33.             <?php } ?>
  34.         </div>
  35.     <?php } ?>
  36.    
  37.     <div style="clear: both"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement