You can use shortcodes to do almost anything in WordPress. You can also use Toolbox shortcodes to get whatever field and apply whatever template you want inline.
Every setting that is available in the Modules, is also available in the shortcodes. So, if you're extending to accept more parameters, you can also use those to alter the results of a
There are three shortcodes that you can use:
The toolbox shortcode is the main shortcode for this plugin. It is used to retrieve a field render it to the browser.
You can use it like this:
But you can also provide your settings while requesting the field:
[toolbox field="company_logo" size="medium" tag="true"]
would get the company_logo field from this post. It retrieves the medium sized thumbnail and adds tags around the url, adds the title- and alt-tag if it's stored as an Array or ID in the database. It also applies default alignment.
NOTE: How these settings are handled is manageable by the
Applying Twig templates
You can also directly apply a Twig template to the field. This is useful when you want to return a repeater inline, inside another module for instance.
Simply create or copy a twig template to the Twig Templates CPT. Make sure to create a template of type inclusion.
Now add the shortcode:
[toolbox field="myrepeater" twigtemplate="mytemplate"]
The field 'myrepeater' will be passed through the 'mytemplate' template and rendered to the browser.
The toolboxwp shortcode is used to get information from wp and render it to the browser, according to the filters set in the
the toolboxwp shortcode can retrieve the following information:
You can use toolboxwp like this:
to pull the post title.
[toolboxwp field="featuredimage" size="medium" tag="true"]
to pull the featured image of the post, with size medium and a tag surrounding the retrieved url.
The toolboxtwig shortcode is useable when the Timber-library is enabled. The contents of the shortcode is the Twig template that will be processed by the Twig engine.
When calling the shortcode you can also pass in a fieldname:
When providing the field attribute it will return the variables
__field__object for convenience. Respectively they will be the returned value for ACF's
In this section:
- Toolbox Shortcodes