Using Links and URLs

The core function of a button is of course linking it to some action or URL. MaxButtons has a wide array of features to make using links and URLs to your content as easy as possible.

There are several ways to link to your content from MaxButtons. Additionally we offer a few special functions to make some tasks easier.

MaxButtons URL field
The URL field

Linking to Content in your WordPress installation

Insert link dialog

When linking to a page inside your WordPress, the easiest way is to use the 'select site content' button and select the page you want to link to. After selecting click on the Add Link button. The link will appear in the URL field in the button editor.

Linking to content on your site

If the content is on your site, but not reachable via site content, the best approach is to use a relative URL instead of the full URL. Relative means your browser will look on the current domain from the start and try to find the page. This is the most flexible way. Your links will not break when for instance you move to a different domain in the future.

Relative link

Linking to other websites

When linking to another website it's important to use the full URL to that site. This includes the whole domain starting from https:// .

Full domain link
Opens an external link in a new tab / window

You might not want to lose the visitor and open the external webpage in a different window. Under the URL field there is a checkbox for that. Nowadays this will open the site in a new tab. This is browser behavior and can't be changed by the website.

Using Rel NoFollow and Sponsored

When you don't want a search engine to follow this link to the external website there is also the option for 'rel=nofollow'. Note that depending on the content you are linking, this may not always be a good idea. Search engine tend to rank your page higher when you have links to other good content. More information in this guide article on nofollow.

Relativly new is the rel for sponsored. This can be used for linking to sponsored content. If you wish to apply this rule, you can enter it in the field for 'custom rel tag' under the Advanced section.

Using special link schemes

Protocol setting field

A link scheme defines the protocol / application a link should use. https, email, ftp are common link schemes on the internet. MaxButtons supports almost all commonly used schemes . If you notice that a link to some application gets filtered out when saving the button you can add this scheme to the plugin.

In the Settings screen you find the field above to add additional protocols.

Starting a javascript function

Launching a custom Javascript function when a visitor clicks the button can be done with the Javascript event field.

Javascript onclick field

In the button editor, under the advanced section you can find this field. Simply fill out the name of the function you want to launch.

Note: Be sure of Javascript scope of your function and make sure it's callable from the button. If it doesn't work use the developer console in the browser to check any errors!

Using variables in the URL

To make creating dynamic buttons easier when needed, MaxButtons PRO has several variables you can use in the URL field

Variables in a URL field

Handy to know:

  • The variable is denoted by a double pipes (||) on both sides
  • Take note of WordPress' The Loop . Variable behavior will change when in or not in the loop.

Variables:

  • pageurl : Full URL to the current page .
  • permalink: Full URL to the item in the loop. ( Current article in archives, same as pageurl on pages or single posts
  • nextpost: Link to the next post in the same category / post type
  • prevpost : Link to the previous post in the same category / post type .