Return to Snippet

Revision: 15930
at July 21, 2009 08:36 by Ben


Initial Code
<?php query_posts('pagename=about'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div><h4>Type your title here</h4>
<p><?php echo substr(strip_tags($post->post_content), 0, 165); ?>... <a href="<?php bloginfo('url'); ?>/about">Read More</a></p></div>
<?php endwhile; endif;
//Reset Query
wp_reset_query();
?>

Initial URL


Initial Description
This simply pulls 165 characters from a page/post. Important to reset the query.

Initial Title
Wordpress query to pull a snippet from a post/page

Initial Tags
php, wordpress

Initial Language
PHP