Archived

This topic is now archived and is closed to further replies.

  • 0

3 column on main page

Question

Posted · Report post

i m trying to display latest post with thumbnails in 3 columns on a static page. this is the code i am using:

<table border="0" cellspacing="10" cellpadding="0" align="center">
<?php 
$cat=5; 
$cols = 3;
$colsdisp = 0; 
?>
<?php if (have_posts()) : ?>
<tr>
<?php query_posts( 'cat=5$cat&posts_per_page=3' ); ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php
if ($colsdisp == $cols) {
print "</tr>n<tr>n";
$colsdisp = 0;
}
?>
<?php echo "<td width=33%>"; ?>
<?php the_post_thumbnail(); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<br><i><?php $author = get_the_author(); echo $author; ?></i><br>
<p><?php the_excerpt(); ?></p>
<?php echo "</td>n"; ?>
<?php $colsdisp++; ?>
<?php endwhile; else: ?>
<p>Sorry, no products matched your criteria.</p>
<?php
$colsexec = $cols - $colsdisp;
for ($i=1; $i<=$colsexec; $i++) {
}
print "<td valign="top"></td>n";
?>
</tr>
<?php endif; ?>
</table>

it used to work with standard template but not with pagelines framework, could anyone please test it and tell me how do i adapt it or wher is the error?

thanks

Share this post


Link to post
Share on other sites

1 answer to this question

Posted · Report post

Hi there,

 

I'm not sure about a php solution but if I was creating the suggested layout I'd use the plugin - http://wordpress.org/extend/plugins/special-recent-posts/ and the pagelines grid system at - http://demo.pagelines.me/tools/

 

Using a shortcode like

 

<div class="row">
<div class="span4">Your special recent posts shortcode goes here</div>
<div class="span4">Your special recent posts shortcode goes here</div>
<div class="span4">Your special recent posts shortcode goes here</div>
</div>

This will create a three column grid with your recent posts shortcode inside each column, which will return the required content from the posts to display in the layout.

Share this post


Link to post
Share on other sites