I am currently using the live wire theme by woothemes and I want to get the middle column shorter but I don't know how to do it. Here is the code, please help. <div class="col_mid_home"> <div class="mid_box"> <?php $count = 0; $duplicated = array(); $excluding = get_option('woo_mid_exclude'); // Categories to exclude $cats = get_categories('exclude='. $GLOBALS[ex_feat] . ',' . $GLOBALS[ex_vid]. ',' . $excluding ); foreach ($cats as $cat) { $the_query = new WP_Query('showposts=1&posts_per_page=-1&cat='.$cat->cat_ID); while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID; ?> <?php $show = true; foreach ( $duplicated as $test) { if ( $test == $post->ID) { $show = false; } } $count++; $duplicated[$count] = $post->ID; if ($show) { ?> <div class="post-alt blog"> <p class="category"><span><?php echo $cat->cat_name; ?></span></p> <h2><a title="<?php _e('Permanent link to ',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <p class="posted_on"><?php _e('Posted on',woothemes); ?> <?php the_time('d F Y'); ?> <?php edit_post_link(__('Edit'), ' · ', ''); ?></p> <div class="entry"> <?php the_excerpt(); ?> </div> </div><!--/post--> <?php } ?> <?php endwhile; ?> <?php } ?> </div> </div> Code (markup): I would really appreciate some help, I have messed around with the coding and nothing is changing.
What do you mean by shorter? Less posts or less height? If it is posts, there is probably a setting for it your theme settings. If is height, then you would alter your CSS stylesheet.
On your query, remove the 'show_posts' attribute which has been deprecated in favor of 'posts_per_page'. In this example, I set it to show 5 posts. $the_query = new WP_Query('posts_per_page=5&cat='.$cat->cat_ID); Code (markup): More information can be found in the parameter section of the query_posts docs at WP Codex
Thanks Dodger, I tried what you recommended and it still isn't working, It actually added 15 more posts to the list.
Oops. My bad. I misread the code. Change the posts_per_page to 1. That will give you 1 post per category listed in the box. (You can see that it is pulling from a list of categories that gets set up prior to the WP_Query call.) If you want less posts, then you have to limit the number of categories that you will be querying. And now, we are full circle. The categories that get excluded are somewhere in the theme settings for the Mid Box (see the get_option('exclude_mid_box')?)