Modify Custom excerpt length


Sponsored Links






wordpress-custom-excerpt-lengthOn WordPress 2.9 there are new featured that we can added on the_excerpt(), one of them is change the excerpt length. How to modify Custom excerpt length is really simple. We only needed to put some function on our functions.php themes file and added some hook to call this functions.

Write down Custom excerpt length below

<?php
// Add custom excerpt length
function custom_excerpt_length($length) {
	return 20;
}
add_filter('excerpt_length', 'custom_excerpt_length');
?>

And done, you have new excerpt length, please note you can modify the value of 20, you can added whatever you want. Or if you want totally new version and using your own excerpt, you can follow our tutorial to create Own Excerpt in WordPress. You can tried using plugin on this method

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

Create you own Excerpt in WordPress

Sometimes we need to limit how many words will be displayed in our excerpt, If you have use WordPress 2.9.x you can use Easy Excerpt method, but if you want something different, you can create own excerpt and replace your … Read More

Easy Excerpt Mods on WordPress 2.9

WordPress 2.9 brings some new features, one of new features is Easy Excerpt Mods via little bit coding on our functions.php theme. Here some tricks how to change excerpt length via this tricks Open your functions.php and add this code … Read More

Tutorial Added Adding Custom Buttons to Editor WordPress

I was written about Customize WordPress WYSIWYG Editor, and on this tutorial is another one. Today we will show you how to adding Custom Button to WordPress Editor. There are so many advantage why we need to added custom button. … Read More

Automatically Create a Custom Field

WP Canyon did wonderful tricks, this tricks is about how to automatically create a custom field when a post is published. This wonderful method is added some code on your functions.php files on your current theme. The first time need … Read More

How To Display Custom Content to Search Engine Visitors

There are so many WordPress blog, some of them added unique features, right now I will show you how to display custom content to Search Engine visitors only, You can replace what do you want to be added on Search … Read More

Create Custom Page with Custom Loop and Query

Created WordPress as CMS? I am guarantee you'll need this tricks. Because WordPress Custom Page is Gregorius tools we can use to create custom design/layout and whatever we want. I will show you how to Create Custom Page with Custom … Read More

Modify Custom excerpt length / WordPress Tricks & Tips

On WordPress 2.9 there are new featured that we can added on the_excerpt(), one of them is change the excerpt length. How to modify Custom excerpt length is really read more

Source: http://wptricks.net/modify-custom-excerpt-length/

wordpress-custom-excerpt-length () / WordPress Tricks & Tips

Daily The Best WordPress Tricks and WordPress Tips to make your WordPress nice read more

Source: http://wptricks.net/modify-custom-excerpt-length/wordpress-custom-excerpt-length/

Customizing the_excerpt() in WordPress — SeanBluestone.com

Modify / Custom Excerpt Length With More Flexible @ sPeEdYtOwN; ercani bilişim » Blog Archive » Wp Custom excerpts Eklentisi Türkçe; HOAX magazine: Just another read more

Source: http://www.seanbluestone.com/customizing-the_excerpt

Change the excerpt length in WordPress - Lances Journal of Simple

Change the excerpt length: There are many cases where a blog author might want to increase or decrease the length of WordPress post excerpts "the_excerpt()". read more

Source: http://www.lancelhoff.com/change-the-excerpt-length-wordpress/

How To preserve HTML Tags in WordPress Excerpt Without a Plugin

If you want to modify the excerpt length based on one category, then find line 25 in function custom_wp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text read more

Source: http://bacsoftwareconsulting.com/blog/index.php/wordpress-cat/how-to-preserve-html-tags-in-wordpress-excerpt-without-a-plugin/


4 Responses to Modify Custom excerpt length

  1. anar says:

    Help please,
    i keep getting this error. i am using thesis theme and this is how my functions are

    add_filter(‘the_excerpt’, ‘my_excerpts’);
    // Function to replace ellipsis with text
    function my_excerpt($text) {
    return str_replace(‘[...]‘, ”, $text);
    }

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘my_excerpts’ not found or invalid function name in C:\xampp\htdocs\wordpress\wp-includes\plugin.php on line 166

    • nobody says:

      @anar
      You used ‘my_excerpts’ plural in the add_filter call, but you defined function my_excerpt singular (without the ‘s’).

  2. Documentare says:

    Thanks for help. I’ve solved the problem.

  3. [...] How to modify Custom excerpt length on WordPress # WordPress Tricks & Tips [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>