Below, you’ll find a detailed guide on how to add the Gantry 4 Framework Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Gantry 4 Framework Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Gantry 4 Framework Plugin and the shortcodes it provides:
"Gantry 4 Framework is a versatile WordPress plugin that provides a flexible structure for creating advanced, responsive themes. Its intuitive interface allows for easy customization and control."
- [loadposition]
Gantry 4 Framework [loadposition] Shortcode
The ‘loadposition’ shortcode from the Gantry plugin is designed to load a specific module position within your WordPress theme. By utilizing the global $gantry object, it checks if modules exist in the specified ‘id’ position. If modules are present, it displays them using the ‘basic’ style.
Shortcode: [loadposition]
Parameters
Here is a list of all possible loadposition shortcode parameters and attributes:
id
– A specific identifier for the modules to be loaded
Examples and Usage
Basic example – A simple shortcode to load a module by its ID.
[loadposition id="module1" /]
Advanced examples
Load a module by its ID, but with additional parameters for layout and style.
[loadposition id="module1" layout="basic" style="basic" /]
Load multiple modules by their IDs. If a module does not exist or is not active, it will be skipped.
[loadposition id="module1,module2,module3" /]
Please note that the shortcode will not output anything if the specified module(s) do not exist or are not active.
PHP Function Code
In case you have difficulties debugging what causing issues with [loadposition]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('loadposition', array($this, 'rok_loadposition'));
Shortcode PHP function:
function rok_loadposition($atts, $content = null)
{
/** @global $gantry Gantry */
global $gantry;
extract(shortcode_atts(array('id' => ''), $atts));
if ($gantry->countModules($id)) :
return $gantry->displayModules($id, 'basic', 'basic');
endif;
}
Code file location:
gantry/gantry/gizmos/loadposition.php
Conclusion
Now that you’ve learned how to embed the Gantry 4 Framework Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply