Return to Snippet

Revision: 49706
at July 28, 2011 11:34 by deepakrajpal


Initial Code
<?php 
//showing welcome post (post id =1)
// retrieve one post with an ID of 5
query_posts( 'p=1' );
function new_excerpt_length($length) {
return 28;
}
add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_more($more) {
global $post;
return '<a href="'. get_permalink($post->ID) . '"> <br />read more....</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');

// set $more to 0 in order to only get the first part of the post
global $more;
$more = 0;

// the Loop
while (have_posts()) : the_post();
the_excerpt();
endwhile;
?>

Initial URL
http://deepakrajpal.com/?p=134

Initial Description

                                

Initial Title
Showing Posts with custom excerpt length and custom read more text in WordPress

Initial Tags
wordpress, text

Initial Language
PHP