Allow HTML in The Grid excerpt/content

Hello,

I have a problem with displaying html in The Grid excerpt. At the moment Wordpress is stripping html from the excerpt and content. I read several solutions and added several codes to my functions.php file but it is not working.

I have set-up a quote in the backend (see screenshot).

The content contains a link and the last line is Italic. On the frontend the post/quote is loaded in The Grid and the excerpt shows only plain text.

How can I fix this? Thx in advanced! Grtz Marco

Hi There,

Thanks for writing in!

Unfortunately WordPress doesn’t allow HTMl content in excerpt.
Please check this two options for possible solutions.


Hope this helps.

Thanks

Hi, Thx for your reply.

I tried that code already but I think I do something wrong because it’s not working.
Also the plugin Advanced Excerpt gives no results…

Hey There,

​To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look at your functions.php file and your codes?

To do this, you can create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

Thank you.

Hello There,

Thanks for providing the information. You’re code is exactly correct. This will work in displaying excerpts like the blog index or archive layouts. Regretfully, The Grid plugin has its own code function that removes any html code present in the excerpt. What you have in mind like adding link in your excerpts may not be possible. We are afraid that we may not be able to assist you further since The grid is a 3rd party plugin. Though it is bundled in the theme, we are not familiar of the code and it requires further assistance from the creators of the plugin. And besides, this particular customization request is outside the scope of our support as this is not related to an issue with the theme or plugin and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself.

By the way, we’ve added this as a feature request so it can be taken into consideration for future development by the creators of The Grid plugin.

Thank you for your understanding.

Hi Rue Nel,

Thx for you reply.

Have you noticed that the links are working in the excerpt?

Only the color is not visible and the italic text is not working. If we can solve this than I’m happy :slight_smile:

Hi There,

You can add the following code to Theme Options CSS

.tg-item .tg-dark a {
color: red !important;
}

Hope it helps!

You’re the master, it works!!! :smile:

Only the italic tag is still not visible

Thx for the great support!

You’re welcome!
Thanks for letting us know that it has worked for you.

Hi,

Just one strange thing:
If I use the code I get a blank page with this code in the inspector: = $0
It happens to some pages. See secure note.
Backend Cornerstone works fine. It only happens on front-end. When I delete the html excerpt code in functions.php all the pages work fine.

What’s wrong here?

Hi there,

I checked the page with Google Chrome browser and it is working ok for me. Anyway, unfortunately, this is something that we can not be of a help as it is a customization which is outside of our support scope.

In general, whenever you encounter a blank page, try to activate the WordPress debug mode to get a better errors showing the actual cause of the problem.

Thank you for your understanding.

Hi Christopher,

I disabled the code so the page does work as it is a LIVE site.
It has to do something within the excerpt code messing up the content. This is the code I use:

// HTML custom excerpt
// =============================================================================

remove_filter(‘get_the_excerpt’, ‘wp_trim_excerpt’);
add_filter(‘get_the_excerpt’, ‘nb_html_excerpt’);

function nb_html_excerpt($text) {
global $post;
if ( ‘’ == $text ) {
$text = get_the_content(’’);
$text = apply_filters(‘the_content’, $text);
$text = str_replace(’]]>’, ‘]]>’, $text);
$text = strip_tags($text, ‘

,,,’);
$excerpt_length = 1000;
$words = explode(’ ‘, $text, $excerpt_length + 1);
if (count($words)> $excerpt_length) {
array_pop($words);
array_push($words, ‘[…]’);
$text = implode(’ ', $words);
}
}
return $text;
}

Hi there,

As this is a third party script, we cannot provide support for this code as this falls under custom development due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

Although as noted by @RueNel, we have already added this in our feature request list so that it will be considered in the future development.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.