Oftentimes in working with WordPress I find that I don’t want things to be as automatic as they are by default. Or, more precisely, I want things to be automatic in a very custom way to fit a certain theme and design.
An example of this is excerpts, this WordPress function annoyed me for a long time, but Advanced Excerpt by Bas van Doren relieves this pain.
In my case, the pain arose from trying to layout text in a grid-style theme. Some of the blocks were populated with photos, while others were not. I wanted to be able to control the excerpt length so that blocks with photos would feature short post excerpts while those without photos would be filled by a larger excerpt.
By creating an if/else statement in PHP, you can use Advanced Excerpt’s the_advanced_excerpt function to create these two different excerpt lengths. The code look like this:
<?php echo strip_tags(the_advanced_excerpt('length=20&use_words=1&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong,font'), '<a><strong>'); ?>
Or, for the longer excerpt:
<?php echo strip_tags(the_advanced_excerpt('length=100&use_words=1&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong,font'), '<a><strong>'); ?>
By placing these statements within a much larger if/else statement I was able to create two unique types of article teaser.
If you have questions about this plugin or would like help implementing the plugin in your theme, drop a comment below or email us at info@readymadeweb.com.



