Page 1 of 1

Featured blog post

Posted: Fri Mar 19, 2010 3:23 pm
by screenwords
Hey everyone

I'm new to PHP and have been modifying code within a theme I have for wordpress. I literally have no idea how to term what I so it's impossible for me to ask so I figured I'd ask you knowledgeable folk.

What I'm trying to do is just display some text, the content, for 5 lines then end and display a 'Read More' link. Here is the code that I'm working with right now:

<div class="box bright">
<?php
$featposts = 1; // Number of featured entries to be shown
$GLOBALS[feat_tags_array] = explode(',',get_option('rox_home_box3_tag')); // Tags to be shown
$clean_tags = array();
foreach ($GLOBALS[feat_tags_array] as $tags){ $clean_tags[] = trim($tags); }
$new_tags = implode(',',$clean_tags);
?>
<?php $saved = $wp_query; query_posts('tag=' . $new_tags . '&showposts=' . $featposts); ?>
<?php if (have_posts()) : $count = 0; ?>
<?php while (have_posts()) : the_post(); $count++; ?>
<h3>Most Recent Blog Post</h3>
<h4><?php the_title(); ?></h4>
<?php the_excerpt(); ?>
<a class="readmore" href="<?php the_permalink() ?>"></a>
<?php endwhile; ?>
<?php endif; $wp_query = $saved; ?>
</div>
<div class="clear"></div>
</div>
</div>

I'm assuming I'd have to implement a while loop, with a variable called line or something, starting at count 0 and to end once it hits 4 or 5 depending on how many lines I want.

Any help would be much appreciated :)

Paul

*EDIT*
I noticed a post under the sticky, viewtopic.php?t=25351, that deals with characters. Is there anyway to display lines?