QuadMenu Shortcode

Below, you’ll find a detailed guide on how to add the WordPress Mega Menu – QuadMenu 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 WordPress Mega Menu – QuadMenu Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the WordPress Mega Menu – QuadMenu Plugin and the shortcodes it provides:

Plugin Icon
WordPress Mega Menu – QuadMenu

"WordPress Mega Menu – QuadMenu is an advanced plugin, designed to create interactive menus. With QuadMenu, customize your website's navigation, enhancing user experience and site functionality."

★★★★✩ (244) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [quadmenu]

QuadMenu [quadmenu] Shortcode

QuadMenu shortcode is a powerful tool in PHP/Wordpress that allows you to customize your website’s navigation. It extracts and applies specific attributes such as ‘echo’, ‘theme’, and ‘theme_location’.

Shortcode: [quadmenu]

Parameters

Here is a list of all possible quadmenu shortcode parameters and attributes:

  • echo – Determines whether the quadmenu is displayed immediately or returned for later use.
  • theme – Defines the theme to be applied on the quadmenu.
  • theme_location – Specifies the location where the theme should be applied.
  • sticky – Controls whether the quadmenu remains visible when scrolling down the page.

Examples and Usage

Basic example – A simple shortcode usage to display a Quadmenu with the default theme.

[quadmenu theme="default" /]

Advanced examples

Displaying a Quadmenu with a custom theme and disabling the echo. The echo attribute determines whether the menu is immediately printed or returned. In this case, it is set to false, so the menu will be returned instead of printed.

[quadmenu theme="custom-theme" echo="false" /]

Displaying a Quadmenu with a custom theme and specifying a theme location. The theme_location attribute is used to identify where in the theme the menu is located.

[quadmenu theme="custom-theme" theme_location="header-menu" /]

Displaying a Quadmenu with a custom theme, specifying a theme location, and enabling the sticky attribute. The sticky attribute, when set to 1, makes the menu stick to the top of the page when scrolling down.

[quadmenu theme="custom-theme" theme_location="header-menu" sticky="1" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [quadmenu] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'quadmenu', 'quadmenu_shortcode' );

Shortcode PHP function:

function quadmenu_shortcode( $atts = array() ) {

	extract(
		shortcode_atts(
			array(
				'echo'           => 'true',
				'theme'          => '',
				'theme_location' => '',
			),
			$atts
		)
	);

	$args = array(
		'echo'           => $echo == 'false' ? false : true,
		'theme'          => $theme,
		'theme_location' => '',
		'sticky'         => 0,
	);

	return quadmenu( $args );
}

Code file location:

quadmenu/quadmenu/lib/frontend/class-integration.php

Conclusion

Now that you’ve learned how to embed the WordPress Mega Menu – QuadMenu 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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *