Jump to content
jankowalski

3 column on main page

Recommended Posts

jankowalski    3
jankowalski

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
James B    436
James B

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.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×