Site icon League WP

How to Use HTML Tags in WordPress Excerpts (Genesis)

HTML in WordPress Excerpts in Genesis

HTML in WordPress Excerpts in Genesis

Although WordPress tends to strip out the all HTML tags in your post excerpts, sometimes, it is useful to highlight a word or phrase in your excerpts. Recently, I wanted to use some HTML tags in my excerpts for a specific project. I wanted to highlight a keyword or keyword phrase in the excerpt for SEO purposes.

Although my solution is more Genesis Framework oriented, you still can use the code to re-purpose for any WordPress projects.

All you have to do is use a code snippet in your functions.php file. As always, I’d like to advise to proceed only if you’re familiar with FTP client, e.g. FileZilla.

Here’s the code snippet you should add to your functions.php if your’e working on a theme running on Genesis Framework.

If it’s a non-Genesis WordPress site, add the following code to your functions.php file to allow HTML tags in your post excerpts.

That’s it – save your work and reload your page to test it.

Let me know if you have any questions.

Exit mobile version