if/else Statement for Excerpt
-
Hello,
In WP 2.7, there’s a section in the editor to enter your own excerpt. I’m trying to write up an if/else statement whereby when that is empty, just grab a certain length from post; otherwise use the excerpt.
This is used in correspondence with “Thumbnail For Excerpts”.
And this is what I have in mind, with the assumption that excerpt_length is the default value for that section in the WP 2.7 editor.
//if('excerpt_length'=0) add_filter('excerpt_length', 'my_excerpt_length'); function my_excerpt_length($length) { return 10; // Or whatever length applicable } //else('excerpt_length')
Thank you for your help.
- The topic ‘if/else Statement for Excerpt’ is closed to new replies.