Below, you’ll find a detailed guide on how to add the Gecka Submenu Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Gecka Submenu Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Gecka Submenu Plugin and the shortcodes it provides:
"Gecka Submenu is a WordPress plugin designed to enhance your website's navigation experience. It simplifies the creation of submenu items, offering a more organized and user-friendly interface."
- [submenu]
- [menu]
Gecka Submenu [submenu] Shortcode
The Gecka-Submenu shortcode is a tool that enables the display of a submenu on your WordPress site. This shortcode, when added, checks if a submenu is specified. If not, it defaults to the current submenu. It then returns the specified or default submenu, enhancing site navigation.
Shortcode: [submenu]
Parameters
Here is a list of all possible submenu shortcode parameters and attributes:
submenu
– Specifies the submenu to display, ‘current’ by default
Examples and Usage
Basic example – A simple usage of the gecka-submenu shortcode plugin, where we don’t specify the submenu attribute. By default, it will take the ‘current’ submenu.
[submenu /]
Advanced examples
Specifying the submenu attribute directly. This will override the default ‘current’ submenu and display the specified submenu instead.
[submenu submenu="custom_submenu" /]
Adding more than one parameter. This example includes the ‘submenu’ attribute and another custom attribute ‘style’. The ‘style’ attribute could be used to apply different styles to the submenu.
[submenu submenu="custom_submenu" style="style1" /]
Note: The actual usage of these shortcodes may vary depending on the functionality provided by the ‘gecka-submenu’ plugin and the attributes it supports.
PHP Function Code
In case you have difficulties debugging what causing issues with [submenu]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('submenu', array($this, 'submenu'));
Shortcode PHP function:
function submenu($Attributes)
{
if (empty($Attributes['submenu'])) $Attributes['submenu'] = 'current';
return $this->menu($Attributes);
}
Code file location:
gecka-submenu/gecka-submenu/models/Shortcodes.php
Gecka Submenu [menu] Shortcode
The Gecka-Submenu shortcode is a powerful tool that generates a submenu based on specified attributes. This shortcode takes attributes, serializes them into a key, and checks if it’s already cached. If it is, it returns the cached menu. If not, it creates a new submenu with the Gecka_Submenu_Submenu class and caches it for future use.
Shortcode: [menu]
Examples and Usage
Basic example – Display a default submenu using the Gecka Submenu plugin.
[menu]
Advanced examples
Display a submenu with a specific theme location. The ‘theme_location’ attribute is used to specify the location of the menu in the theme.
[menu theme_location='header-menu']
Display a submenu with a specific menu ID. The ‘menu’ attribute is used to specify the ID of the menu.
[menu menu='3']
Display a submenu with a specific menu slug. The ‘menu’ attribute is used to specify the slug of the menu.
[menu menu='header-menu']
Display a submenu with a specific container class. The ‘container_class’ attribute is used to specify the CSS class of the menu container.
[menu container_class='my-custom-class']
Display a submenu with a specific container ID. The ‘container_id’ attribute is used to specify the CSS ID of the menu container.
[menu container_id='my-custom-id']
Display a submenu with a specific menu class. The ‘menu_class’ attribute is used to specify the CSS class of the menu itself.
[menu menu_class='my-custom-menu-class']
Display a submenu with a specific depth. The ‘depth’ attribute is used to specify the number of levels in the hierarchy of the menu.
[menu depth='2']
PHP Function Code
In case you have difficulties debugging what causing issues with [menu]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('menu', array($this, 'menu'));
Shortcode PHP function:
function menu($Attributes)
{
$key = serialize($Attributes);
if (isset(self::$cache[$key])) return self::$cache[$key];
$Menu = new Gecka_Submenu_Submenu();
return self::$cache[$key] = $Menu->Get($Attributes);
}
Code file location:
gecka-submenu/gecka-submenu/models/Shortcodes.php
Conclusion
Now that you’ve learned how to embed the Gecka Submenu Plugin shortcodes, 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