Site icon WP Smith

How to Add Formatting Tags to Genesis's Content Limit in Content Archives

Recently, I started limiting my content by using Display Post Content under Genesis > Theme Settings > Content Archives instead of using Display Post Excerpt. While the default is Display Post Content, the next field Limit content to ## characters is usually blank. However, I wanted to limit the content archives while maintaining my formacodeing.

So, upon limiting my content, I discovered that this actually strips all the tags except <code><script></code> and <code><style></code>. However, I wanted to allow basic formacodeing tags like <code><b></code>, <code><em></code>, and <code><br></code>. Gratefully, Genesis has a filter that will allow you to keep these tags in the content limit. To add the tags, you will need to add a filter in your functions.php.

[php]
add_filter('get_the_content_limit_allowedtags', 'get_the_content_limit_custom_allowedtags');
function get_the_content_limit_custom_allowedtags() {
return '<script>,<style>,<b>,<br>,<em>'; //add whatever tags you want to this string
}
[/php]