Adding Dynamic Variables with WPMasterToolKit's "Add Essentials Shortcodes" Module
There are many dynamic customization needs on WordPress: displaying the name of the logged-in user, retrieving specific metadata from an article or displaying information about a category. Instead of using multiple plugins or writing complex PHP code, WPMasterToolKit's "Add Essentials Shortcodes" module offers a simple and effective solution. With this module, you can easily insert dynamic variables into your titles, content or widgets using shortcodes.
Which plugins can this module replace?
This module can replace several plugins often used to display metadata or dynamic information via shortcodes. These include :
- Plugins to manage dynamic shortcodes for users or articles.
- Extensions to display metadata from taxonomies or custom terms.
By combining these functions in a single module, WPMasterToolKit simplifies resource management and improves performance.
Key features of the "Add Essentials Shortcodes" module
The "Add Essentials Shortcodes" module provides three types of shortcodes for retrieving specific information on usersthe articles and terms. Here are details of the available shortcodes and what they can do:
1. Shortcode for users : [wpmtk_aes_user]
This shortcode lets you display information about a user, such as their IDhis emailhis display name or any user metadata.
Available attributes :
id
The ID of the targeted user. By default, it retrieves the currently logged-in user.key
The key of the user metadata to be displayed (for example :user_email
,display_name
or any other custom metadata).
Example of use:
[wpmtk_aes_user id="3" key="display_name"]
This will display the user's display name with ID 3.
2. Shortcode for articles : [wpmtk_aes_post]
With this shortcode, you can retrieve data associated with an item, including its native information (such as the title or author) or its custom metadata.
Available attributes :
type
The type of content (e.g.post
,page
or a custom content type). By default, it targets the current content type.key
The item's metadata key (e.g. :post_title
,post_date
or any other metadata key).
Example of use:
[wpmtk_aes_post type="product" key="price"]
This will display the metadata value price
for a WooCommerce product.
3. Shortcode for : [wpmtk_aes_term]
This shortcode is useful for displaying information about a categorya tag or any other taxonomy. It can also retrieve custom metadata associated with a term.
Available attributes :
id
The ID of the target term. By default, it targets the current term.key
The metadata key of the term (e.g. :name
,slug
or custom metadata).
Example of use:
[wpmtk_aes_term id="5" key="description"]
This will display the category description with ID 5.
How to use this module
Step 1: Activate the module
Go to the WordPress dashboard and access WPMasterToolKitand activate the Add Essentials Shortcodes.
Step 2: Adding shortcodes
Insert any of the shortcodes into your WordPress content, widgets or templates to suit your needs. Attributes are fully customizable to suit your use.
Step 3: Configure from submenu
A dedicated submenu has been added to the administration panel, allowing you to :
- View all available metadata for users, articles and terms.
- Automatically generate custom shortcodes using interactive drop-down menus.
Our technical choices
1. Using native shortcodes
Shortcodes are natively supported by WordPress, guaranteeing optimal compatibility with all themes and extensions.
2. Custom metadata management
This module uses native WordPress APIs, such as get_user_meta
, get_post_meta
and get_term_meta
to retrieve metadata. This guarantees total flexibility while remaining faithful to WordPress standards.
3. Optimized performance
The module loads only the data required to display the requested shortcodes, avoiding any unnecessary loading of resources.
Conclusion
WPMasterToolKit's "Add Essentials Shortcodes" module is a powerful solution for dynamizing your WordPress content. In just a few clicks, customize your pages, posts or taxonomies with dynamic variables, all without compromising performance. Whether you're a developer or a non-technical user, this module simplifies the customization of your WordPress site. Take the opportunity to replace several plugins with this all-in-one feature!