HTML Entities In Gantry & WordPress

I was working in Ganty 5 for a Joomla site and decided to use Gantry for the WordPress blog. I had purchased some “Particles” from Inspiretheme.com. They have a WordPress particle they call Content Pro. It takes the articles and makes them blocks to show in the front page. It worked great; however, the titles were show the HTML Entities and not the character I wanted.

I contacted InspireTheme, but my subscription was over and they wanted me to resubscribe to get support. The fix seemed so easy; however, I didn’t know where to start. With some playing around I found what I was looking for. It turned to be the “content-pro-wordpress.html.twig” file located “wp-content/themes/g5_hydrogen/custom/particles/”. Here is what I needed to change.

{{- display.title.limit ? article.title|truncate_text(display.title.limit) : article.title -}}

Changed to:

{{- display.title.limit ? article.title|truncate_text|raw(display.title.limit) : article.title|raw -}}

What I had to change was to add “|raw” at the end of the variable. Twig is powerful and helpful, but still new to me. The following links were good help to helping me understand TWIG filters.

http://docs.gantry.org/gantry5/advanced/twig-filters

https://wordpress.stackexchange.com/questions/318934/shortcode-returns-escaped-html-tags

I hope this helps someone else out there….

0 Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>