Shortcodes
Glossary by Codeat includes some shortcodes that allow you to use your glossary independently of the automatic engine for the plugin. Thanks to the shortcodes, you can also ignore certain terms within a specific content, display an alphabetical index, and list categories or terms within posts and pages.
List of Categories
Shortcode: [glossary-cats]
This shortcode generates a list of your glossary’s categories, as in to the example below:
Optional shortcode parameters
order : asc
or desc
This shortcode regulates the order, ascending or descending, in which categories are listed. For example, to show a list in ascending order, your shortcode should be: [glossary-cats order="asc"]
num
With this shortcode, you can adjust the number of categories to show. For example, if you wish to show only 5 categories, your shortcode should be: [glossary-cats num="5"]
Tip
You can combine the optional parameters in the way you think is most useful for you.
For example: [glossary-cats order="asc" num="5"]
List of Terms
Shortcode: [glossary-terms]
If you are using a shortcode from Glossary v1.x., keep in mind that some parameters changed, so you should check the legacy paragraph below.
This shortcode will generate a list of your glossary’s terms, similar to the example below.
Optional shortcode parameters
order : asc
, desc
or last
This shortcode regulates the order, ascending or descending, in which terms are listed. For example, to show a list in ascending order, your shortcode should be: [glossary-terms order="asc"]
.
If you want the latest terms created use last
as value in this way automatically will set the order on asc
but will use the latest terms.
num
With this shortcode, you can adjust the number of terms to show. For example, if you wish to show only 20 terms, your shortcode should be: [glossary-terms num="20"]
theme : (default)
hyphen
, tilde
, dot
or arrow
This parameter change the UI of the term list. If set as default, the terms will be the classic list otherwise will change the symbol before the item, your shortcode should be: [glossary-terms theme="tilde"]
tax
This shortcode allows you to filter your list through an established classification (taxonomy).
Let’s say you wish to classify your key terms as ”fruits” or “vegetables”. You can create your Terms categories (fruits; vegetables) and then group your key terms as either one or the other.
So you can populate your vegetables list thanks to this shortcode: [glossary-terms tax="vegetables"]
Repeat the same procedure for the terms of the ”fruits” category.
Attention
This shortcode parameter requires the category slug or the ID. You can check the slug in the Terms Categories page under Glossary > Terms Categories
Tip
You can combine the optional parameters in the way you think is most useful for you.
For example: [glossary-terms num="25" order="desc" tax="rock-music"]
Legacy Parameters (prior to 2.0 version)
old : new
tax
:taxonomy
Glossary Index (Premium)
Shortcode: [glossary-list]
If you are using a shortcode from Glossary v1.x., keep in mind that some parameters changed, so you should check the legacy paragraph below.
This Premium shortcode generates an alphabetical index for all your Glossary terms. See the example below:
Attention
The output of this shortcode is cached daily in a transient, so you might not see the new terms right away. To view the changes before the cache expires you can clear the transient from the appropriate button.
Optional shortcode parameters
letter-anchor : true
(default) or false
This parameter regulates how the letter is linked to its anchorage: within the same list or to its archive page.
If you do not set this parameter or set it to true, the letter will be linked to the same page's relative anchor.
[glossary-list letter-anchor="true"]
If you set it to false, the letter will be linked to a dedicated archive page that groups all the terms beginning with that letter:
[glossary-list letter-anchor="false"]
term-anchor : true
(default) or false
If this parameter is set to true
, then the terms in the list will not have any links:
[glossary-list term-anchor="true"]
custom-url : true
or false
(default)
If this parameter is true
it will print the Internal/External URL set in the term.
Attention
The Internal/External URL of the term cannot be empty, and the term-anchor parameter must be set to false (default).
[glossary-list custom-url="true"]
empty-letters : true
(default) or false
This parameter adjusts the visibility of letters that are not linked to any term. If set to true (default), the index will show all letters, including those containing no terms. If set to false, the table of contents will only show letters that match the terms of the glossary.
[glossary-list empty-letters="false"]
taxonomy
This parameter allows you to filter your list through an established classification (taxonomy).
Let’s say you wish to classify your key terms as “fruits” or “vegetables”. You can create your Terms categories (fruits; vegetables) and then group your key terms as either one or the other.
So your vegetables list will be populated thanks to this shortcode: [glossary-list taxonomy="vegetables"]
Attention
This shortcode parameter requires the category slug or ID. You can check the slug in the Terms Categories page under Glossary > Terms Categories
Tip
If you need to enter more than one category, separate them with a comma.
For example: [glossary-list taxonomy="rock,pop,blues,country"]
theme : (default)
grid
or summary
This parameter adjusts the layout of the term list. If set as default, the terms will be grouped by letter and listed as a list.
If it’s set to grid, the terms will be placed side by side in columns, check the demo page for grid theme or for summary theme.
[glossary-list theme="grid"]
search : disabled
(default), scroll
, scroll-bottom
or no-scroll
With this parameter, you can show a search bar that points to the term in the list. If set to no-scroll
the search bar will not scroll along with the page and will remain anchored at the top, above the letter bar.
Using the scroll-bottom parameter the search field will be fixed at the bottom of the screen.
[glossary-list search="scroll"]
excerpt : true
or false
(default)
By setting this parameter to true
, you can show the excerpt alongside the term.
[glossary-list excerpt="true"]
content : true
or false
(default)
By setting this parameter to true
, you can show the content alongside the term.
[glossary-list content="true"]
custom-fields : false
(default) or true
By setting this parameter to true
, if you are using the native feature for custom fields in your term you can show them.
[glossary-list custom-fields="true"]
featured-image : false
(default) or true
By setting this parameter to true
, you can show the featured image of the term.
[glossary-list featured-image="true"]
accordion : false
(default) or true
By setting this parameter to true
, you can show on click the text inside a term in the list.
[glossary-list accordion="true"]
show-letter
This parameter allows you to show specific letters.
[glossary-list show-letter="A,C,D,Z"]
Attention
If you need to enter more than one letter, separate them with a comma.
Tip
You can combine the optional parameters in the way you think is most useful for you.
For example: [glossary-letters excerpt="true" search="no-fixed" letters="D,N,S,T,X" theme="grid"]
Legacy Parameters (prior to 2.0 version)
old : new
anchor
:letter-anchor
customurl
:custom-url
empty
:empty-letters
letters
:show-letter
noanchorterms
:term-anchor
- (now parameter is inverted)search
: values are changed,false/disabled
ortrue/scroll
orno-fixed/no-scroll
Parse content (Premium)
Shortcode: [glossary]the text you want to parse from Glossary[/glossary]
This is a Premium shortcode that passes a specific paragraph (not a single term) through the glossary engine and output it with all the links to the related terms found within it.
It’s useful if you’re using Visual Composer, Page Builder (also Gutenberg). Generally speaking, page builders are not easy to support because they tend to behave in a non-standard way. Sometimes, this may cause Glossary not to execute automatically or to parse incorrect content: in these scenarios, the shortcode fixes the issue.
Tip
The shortcode ignores the plugin settings of the post type, so you can also run it on every post type.
Ignore terms (Premium)
Shortcode: [glossary-ignore]the text you want to parse from Glossary[/glossary-ignore]
This is a Premium shortcode that makes the plugin ignores specific paragraph (not only a single term) when the glossary link-engine is active on the page.
It’s useful if you’re using Visual Composer, Page Builder (also Gutenberg). Generally speaking, page builders are not easy to support because they tend to behave in a non-standard way. Sometimes, this may cause Glossary not to execute automatically or to parse incorrect content: in these scenarios, the shortcode fixes the issue.
Tip
The shortcode ignores the plugin settings of the post type, so you can also run it on every post type.