-
AuthorPosts
-
March 8, 2026 at 2:21 pm #1495858
Hi,
How can I style the excerpt belonging to a post? I would like to use focuscolors on certain words and spread it over multiple lines. Is there a possibility for? Can I use inline html or something like that?Regards Erwin
March 9, 2026 at 11:19 am #1495873Hey Erwin,
Thank you for the inquiry.
Yes, it is possible to add inline html to the post excerpt. You can go to Posts > All Posts, edit the post you want to modify, and add your custom html directly in the excerpt field. For example, you can wrap certain words in a span tag with a custom class, like this:
This is the <span class="av-highlight">highlighted word</span> in the excerpt.Then you can style that class using custom css in Enfold > General Styling > Quick CSS or via Appearance > Customize > Additional CSS:
.av-highlight { color: orange; }Just keep in mind that the excerpt field in WordPress does not show a visual editor by default, so you would need to type the html directly in the plain text field. Also, some themes or plugins may strip html tags from the excerpt, but Enfold generally allows basic inline html tags like span to pass through.
Let us know if you have more questions.
Best regards,
IsmaelMarch 9, 2026 at 1:46 pm #1495883Hi Ismael,
On my site I’m using a post grid and a masonry gallery, both should show title and excerpt. Within the post grid it shows the inline html as you suggested, in the masonry gallery it doesn’t. Any idea how to solve this?
Best regards,
Erwin
March 9, 2026 at 1:53 pm #1495884try in your child-theme functions.php:
function my_avf_masonry_loop_entry_content($loop_excerpt, $entry) { $loop_excerpt = $entry->post_excerpt; return $loop_excerpt; } add_filter('avf_masonry_loop_entry_content', 'my_avf_masonry_loop_entry_content', 10, 2);or maybe better only allow some tags that are not stripped:
function my_avf_masonry_loop_entry_content($loop_excerpt, $entry) { $loop_excerpt = strip_tags( ($entry->post_excerpt) , '<br><p><span>' ); return $loop_excerpt; } add_filter('avf_masonry_loop_entry_content', 'my_avf_masonry_loop_entry_content', 10, 2);March 9, 2026 at 2:02 pm #1495885Thank you, I’ve used the second one and it works great!
Regards,
ErwinMarch 9, 2026 at 3:20 pm #1495888ok – the only difference is that you only allow in this case : br-tags; p-tags and span-tags
March 9, 2026 at 3:24 pm #1495889Yes, I understand, but that will be enough. I will only be using the br and span-tags.
-
AuthorPosts
- You must be logged in to reply to this topic.
