Skip Navigation

[Resolved] Display custom term meta inline next to term title

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user has a term field to store an icon and he would like to display the icon next to the term in taxonomy archives.

Solution:
It turns out that icon field is actually a WYSIWYG field and will always be subject to filtering, which will add

tags which will make the term title appears on the following line. This requires using the arguments output="raw" and suppress_filters="true" on the types shortcode:

[types termmeta="resource-type-icon" output="raw" suppress_filters="true"][/types]

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#wysiwyg

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by samO-2 4 years, 6 months ago.

Assisted by: Jamal.

Author
Posts
#1946093
Screen Shot 2021-02-13 at 3.54.46 PM.png

Tell us what you are trying to do? Display custom term meta inline next to term title

Is there any documentation that you are following? https://toolset.com/documentation/user-guides/views/displaying-wordpress-term-fields/

Is there a similar example that we can see? https://toolset.com/wp-content/uploads/2019/03/1208859-screenshot_3.jpg

What is the link to your site? hidden link

I set up a custom term to display the icon, but I can't get it to display inline with the taxonomy title.

#1947029

Hello and thank you for contacting the Toolset support.

Currently, the icon is set in its own <p> tag, and the title is outside of it. Check this screenshot hidden link
The <p> tag is a block-level element, it takes its own block and can't be aligned with something else. Its content, on the other hand, are aligned in the same block. Read more about it here hidden link

If you need to make them aligned they need to be, both, on the same <p> tag. Or you need to use a different tag, such as <div> which is not possible if you are putting them inside a Fields&Text block.

To better assist you with this, I would like to login to your website and check it on the backend. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1958147

The icon is a custom field of type WYSIWYG hidden link
So, it will always be formatted to wrap each line inside a <p> tag. The trick is to get the raw data of the field and remove any filters by using the arguments output="raw" and suppress_filters="true" on the types shortcode:

[types termmeta="resource-type-icon" output="raw" suppress_filters="true"][/types]

This way the icon won't be wrapped in a <p> tag and the title will be aligned with it on the same line. hidden link

I hope this helps. Let me know if you have any questions.

#1958565

My issue is resolved now. Thank you!