Hi everybody,
I hope somebody could help me to solve this:
My site has 10 parent pages and each one has got appr 50 children pages.
What I need is to display the children in 4 or 5 columns plus thumbnails (which I’ve already added to the pages as custom fields) on their parents. I’ve found this code:
<?php
//display page titles, if custom field imageurl display image instead of title
$args=array(
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'page',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'List of Posts';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php
$imageurl = get_post_meta($post->ID, 'imageurl', true);
if ($imageurl) { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><img src="<?php echo $imageurl; ?>" alt="Post Image" width="76" height="76" /></a>
<?php } else {
?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
}
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
but the list it displays is very long. That’s why I need to brake it in 4 or 5 columns.
Any suggestions how to do this?