I'm customizing a Wordpress Theme and i have stucked in add a custom class to the "the_excerpt()".
I have searched on the web for this function, but nothing is specific to add a custom class.
Hm, i've tried the "get_the_excerpt", but this one doesn't work (returns nothing).
Anyone knows how to do this?
An excerpt can be auto generated by a WordPress theme or by using the <! --more--> tag inside the post content. Another way to create excerpts for a WordPress post is by entering the summary of an article in Excerpt field on Post Edit screen. This field is not displayed in the post edit screen by default.
Log in to your WordPress admin panel. In the left column navigation, mouse over the “Plugins” link and click the “Add New” link. In the “Search plugins…” box, enter “Easy Custom Auto Excerpt.” Once you have located the plugin, click the “Install Now” button.
Displays the excerpt of the current post after applying several filters to it including auto-p formatting which turns double line-breaks into HTML paragraphs. It uses get_the_excerpt() to first generate a trimmed-down version of the full post content should there not be an explicit excerpt for the post.
<?php echo get_the_excerpt(); ?>
Shows the excerpt
<p class="your-class"><?php echo get_the_excerpt(); ?></p>
Shows the excerpt in a div with a class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With