Show snippet from page on homepage

Hello there,

I have setup this site: www.casasport.org using a WP template. I’m trying to edit the coding for the homepage. There are three “preview boxes” for pages along the bottom: About, Sponsors, and Player Spotlight. I can point it to the page in the theme options, however if the About page is 500 words or 1000 words it will show everything on that page in the preview box.

Is there a way to add just a snippet of code to only pull in the first say 25 or 50 words so the homepage can only show that and you need to click the “read more” link to jump to that page?

I hope I’m explaining myself well enough. If you need me to clarify please don’t hesitate to ask.

Thanks for any and all help. The part of the home.php that includes the home boxes is below.

Lorne

   <!-- BEGIN HOME CONTENT -->
	   <!-- begin home boxes -->
		<?php $box1=get_post(get_option('boldy_home_box1'));
				  $box2=get_post(get_option('boldy_home_box2'));
				  $box3=get_post(get_option('boldy_home_box3')); 
				  if(get_option('boldy_home_box1')!= null && get_option('boldy_home_box2')!= null && get_option('boldy_home_box3')!= null){?>
		<div id="homeBoxes" class="clearfix">
			<div class="homeBox">
				<h2><?php echo $box1->post_title?></h2>
				<?php echo apply_filters('the_content', $box1->post_content);?>
				<a href="<?php echo get_option('boldy_home_box1_link')?>"><strong>Read more &raquo;</strong></a>
			</div>
			<div class="homeBox">
				<h2><?php echo $box2->post_title?></h2>
				<?php echo apply_filters('the_content', $box2->post_content);?>
				<a href="<?php echo get_option('boldy_home_box2_link')?>"><strong>Read more &raquo;</strong></a>
			</div>
			<div class="homeBox last">
				<h2><?php echo $box3->post_title?></h2>
				<?php echo apply_filters('the_content', $box3->post_content);?>
				<a href="<?php echo get_option('boldy_home_box3_link')?>"><strong>Read more &raquo;</strong></a>
			</div>
		</div>
		<?php }?>
		<!-- end home boxes -->
	   <!-- END HOME CONTENT -->

Use the substr() function on the variable holding the text before display to get and/or display only x number of characters of a string.

Have you tried using the substr function? For example;

echo substr(apply_filters('the_content', $box1->post_content), 0, 50);

or

echo apply_filters('the_content', substr($box1->post_content, 0, 50));

That’s great, this worked almost perfectly! I got it working, however is it possible to have it pull words not characters?

This is what I have now:

	   <!-- BEGIN HOME CONTENT -->
	   <!-- begin home boxes -->
		<?php $box1=get_post(get_option('boldy_home_box1'));
				  $box2=get_post(get_option('boldy_home_box2'));
				  $box3=get_post(get_option('boldy_home_box3')); 
				  if(get_option('boldy_home_box1')!= null && get_option('boldy_home_box2')!= null && get_option('boldy_home_box3')!= null){?>
		<div id="homeBoxes" class="clearfix">
			<div class="homeBox">
				<h2><?php echo $box1->post_title?></h2>
				<?php echo substr(apply_filters('the_content', $box1->post_content), 0, 175);?>...
				<br /><br /><a href="<?php echo get_option('boldy_home_box1_link')?>"><strong>Read more &raquo;</strong></a>
			</div>
			<div class="homeBox">
				<h2><?php echo $box2->post_title?></h2>
				<?php echo substr(apply_filters('the_content', $box2->post_content), 0, 175);?>...
				<br /><br /><a href="<?php echo get_option('boldy_home_box2_link')?>"><strong>Read more &raquo;</strong></a>
			</div>
			<div class="homeBox last">
				<h2><?php echo $box3->post_title?></h2>
				<?php echo substr(apply_filters('the_content', $box3->post_content), 0, 175);?>
				<a href="<?php echo get_option('boldy_home_box3_link')?>"><strong>Read more &raquo;</strong></a>
			</div>
		</div>
		<?php }?>
		<!-- end home boxes -->
	   <!-- END HOME CONTENT -->