Note that there are some explanatory texts on larger screens.

plurals
  1. POlooping through Wordpress posts
    text
    copied!<p>i am trying to get wordpress posts, 3 at a time, this is the code i'm using:</p> <pre><code> &lt;?php while ( have_posts() ) : the_post() ?&gt; &lt;?php if(get_post_meta($post-&gt;ID, 'feature', true) != true) {; ?&gt; &lt;div class="show_col"&gt; &lt;?php for ($i = 1; $i &lt;= 3; $i++) { ?&gt; &lt;div class="set"&gt; &lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php printf( __('Permalink to %s', 'your-theme'), the_title_attribute('echo=0') ); ?&gt;" rel="bookmark"&gt; &lt;img class="image" src="http://localhost/portpress/wp-content/themes/myTemp/portfolio/&lt;?php echo get_post_meta($post-&gt;ID, 'intro_thump', true); ?&gt;.jpg" width="300px" alt="AUREL #&lt;?php the_ID(); ?&gt;" /&gt; &lt;/a&gt; &lt;?php the_content("&lt;P class='more'&gt; Read More &amp;#187; &lt;/p&gt;"); ?&gt; &lt;/div&gt; &lt;?php }; ?&gt; &lt;/div&gt; &lt;?php }; ?&gt; &lt;?php endwhile; ?&gt; </code></pre> <p>i know this loop is echoing ONE post THREE times - but what i really want is this end result</p> <pre><code> &lt;div class="show_col"&gt; &lt;div class="show_col"&gt; post1 &lt;/div&gt; &lt;div class="show_col"&gt; post2 &lt;/div&gt; &lt;div class="show_col"&gt; post3 &lt;/div&gt; &lt;/div&gt; &lt;div class="show_col"&gt; &lt;div class="show_col"&gt; post4 &lt;/div&gt; &lt;div class="show_col"&gt; post5 &lt;/div&gt; &lt;div class="show_col"&gt; post6 &lt;/div&gt; &lt;/div&gt; &lt;!-- and so on --&gt; </code></pre> <p>i am doing this as the height of each post varies - therefore i add something like .show_col{clear:both} so that the next three posts go under neath</p> <p>i hope you could help</p> <p>thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload