tags:

views:

14

answers:

1

Hai, I am designing a blog in wordpress. I am facing problem when I display the topic through the_excerpt().It only display 3 lines and then Continue Link comes.But I want each post will come with 6-10 line and the continue-> link.how I can increase the line numbers.

A: 

You need to add an excerpt_length filter to your theme before you call the_except.

In the filter you sepcify how many words you want in your except (you can only specify words, not lines).

An example:

function my_excerpt_length($length) {
    return 120;
}
add_filter('excerpt_length', 'my_excerpt_length');

If you REALLY want to filter on a certain number of lines, you could call get_the_content and extract the number of lines you wanted - but make sure you filter the content to ensure nothing unwanted makes it into your blog.

Robert Christie
Okay ,Well.. In my wp-includes/formatting.php their is already "excerpt_length" as 55.I change it to 150. still it's not working....check the some code given bellow of formatting.php.phpfunction wp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) { $text = get_the_content(''); $text = strip_shortcodes( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $excerpt_length = apply_filters('excerpt_length', 55);one more Q? is thatWhich file I have to add themy_excerpt_length($length){}
JAMES
@James, You should really not be changing wp-includes/formatting.php as this is part of the base wordpress install.You can make changes to your theme - (your probably using the default theme at the moment). In the wordpress theme editor Administration -> Design - > Theme Editor (or another editor if you prefer) Add the code above inside some <?php ?> braces and this will do what you want.
Robert Christie