WordPress Glossary Plugin (CMTG) - Extras - Advanced Custom Fields (ACF) Support
Advanced Custom Fields (ACF) Support
What is This Feature
The WordPress Glossary plugin can show tooltips on custom fields managed by the ACF plugin.
The example below shows a custom field from a post being highlighted and triggering a tooltip.
How It Works: Technical Aspect
By default, the WordPress Glossary plugin parses the content of posts/pages in search of the defined Glossary Terms using the "the_content" filter.
However, the ACF fields are not using this filter for the output, which means that, despite the fact that they can contain complex HTML structures and many site owners are using them to built their layouts, they won't highlight the terms by default.
To enable the parsing of the ACF fields, we have identified the code that ACF uses instead of "the_content", and we have prepared a set of options allowing you to setup the parsing.
After enabling it, the terms are parsed using exactly the same logic as the post/page content.
Video Tutorial
Settings
The ACF settings are available in a section under Admin Dashboard → CM Tooltip Glossary → Settings → General Settings tab.
Then head to the Advanced Custom Fields Settings section.
In the settings section you can setup the following:
- Highlight terms in ACF Fields? - Enables the whole functionality, regardless of what you set in the others, after unchecking this the terms won't be highlighted in the ACF fields.
- Types of fields to highlight - Advanced Custom Fields come with many different field types, from which we've identified the five types which will most likely contain the terms to highlight.
- Types of fields to remove the WP functions - By default, WordPress uses the functions which automatically wrap texts with paragraphs and adds newlines. These functions are often unwanted in case of ACF fields and removed with the 'hacks'. After enabling the parser they were reapplied, so this setting allows to again remove those functions adding paragraphs and newlines.
- Types of fields to wrap with the <span> tag - Wraps the fields with the <span> tag. Learn about the HTML span tag
- Don't use the DOM parser for ACF fields? - Warning: this setting should only be changed in case of problems. This setting allows to change our complicated HTML aware DOM parser with much simpler method of highlighting the terms.
- Excluded ACF Field IDs - using this field you can exclude a single field or group of fields from being parsed using either field name or field key:
- Field Name - example "item_desc_accordion_issue"
- Field Key - example "field_5888e68d97aa8"
How to obtain a Field Name and Field Key
Both can be obtained from the screen where you define the Advanced Custom Fields.
Field Names are displayed by default, and they always are a lowercased string concatenated with underscores(_).
Field Keys are not displayed by default, to show them you have to enable it in the Screen Settings.
Other settings which may affect the functionality
After enabling the feature and setting it up, all settings which would affect tooltips will affect also the ones found in ACF fields.
Check the Getting Started - Tutorials Roadmap.
More information about the WordPress Glossary Plugin Other WordPress products can be found at CreativeMinds WordPress Store |
|
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |