MaxButtons Shortcodes

Below, you’ll find a detailed guide on how to add the WordPress Button MaxButtons 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 WordPress Button MaxButtons Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the WordPress Button MaxButtons Plugin and the shortcodes it provides:

Plugin Icon
WordPress Button Plugin MaxButtons

"MaxButtons is a powerful WordPress Button Plugin. It simplifies the process of creating and customizing stylish buttons for your website, enhancing user engagement."

★★★★☆ (1091) Active Installs: 100000+ Tested with: 6.3.2 PHP Version: 7.0
Included Shortcodes:
  • [maxbutton]
  • [maxcollection]

MaxButtons [maxbutton] Shortcode

The MaxButtons shortcode is a tool that helps display a button on your WordPress site. It calls a function that returns a button class, enabling customization.

Shortcode: [maxbutton]

Examples and Usage

Basic example – A shortcode to display a button using the ‘maxbutton’ shortcode. The ID of the button to be displayed is passed as a parameter.

[maxbutton id="1" /]

Advanced examples

Adding more parameters to the shortcode allows for greater customization. Here, we’re not only referencing the button by its ID, but also specifying the text to be displayed on the button and its URL.

[maxbutton id="1" text="Click Me" url="http://example.com" /]

In this next example, we’re using the shortcode to display a button with a specific text and URL, but we’re also adding a ‘newtab’ parameter. When set to ‘true’, this parameter will make the button open the URL in a new browser tab.

[maxbutton id="1" text="Click Me" url="http://example.com" newtab="true" /]

Lastly, we can use the ‘nofollow’ parameter to instruct search engines not to follow the link. This can be useful for SEO purposes.

[maxbutton id="1" text="Click Me" url="http://example.com" newtab="true" nofollow="true" /]

PHP Function Code

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

Shortcode line:

add_shortcode('maxbutton', array($this, 'shortcode'));

Shortcode PHP function:

function shortcode($atts)
	{
		 $button = $this->getClass("button");

		 return $button->shortcode($atts);
	}

Code file location:

maxbuttons/maxbuttons/classes/maxbuttons-class.php

MaxButtons [maxcollection] Shortcode

The MaxCollection shortcode is a feature of the MaxButtons plugin. It’s designed to fail silently, returning false when called and not producing any output.

Shortcode: [maxcollection]

Examples and Usage

Basic example – The ‘maxcollection’ shortcode allows you to display a collection of buttons. In its simplest form, it doesn’t require any parameters or attributes.

[maxcollection /]

Advanced examples

While the basic ‘maxcollection’ shortcode doesn’t require any parameters, you can use attributes to customize its behavior. For instance, you can specify a particular collection to display by using the ‘id’ attribute:

[maxcollection id=3 /]

You can also use multiple attributes to further customize the shortcode. For example, you can specify both the ‘id’ and ‘title’ attributes. If the collection with the specified ID cannot be found, the shortcode will try to load the collection with the specified title:

[maxcollection id=3 title="My Collection" /]

PHP Function Code

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

Shortcode line:

add_shortcode('maxcollection', array($this, 'collection_shortcode'));

Shortcode PHP function:

function collection_shortcode($atts, $content = null)
	{
		return false; // no more. silent fail.

	}

Code file location:

maxbuttons/maxbuttons/classes/maxbuttons-class.php

Conclusion

Now that you’ve learned how to embed the WordPress Button MaxButtons 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.

Comments

Leave a Reply

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