In this tutorial I create simple button shortcode with three attributes:

  • url
  • target
  • background

Put this code in your functions.php file


By the same principle, you can add attributes to an array and display them in a shortcode.

Now set the CSS styles for the button


The button is ready, to output it add this shortcode in text editor:

[btn_big url=""]Sample button[/btn_big]

Only change the link to the one you need.
If you want open link in a new window, add the attribute target="_blank" to shortcode:

[btn_big url="" target="_blank"]Sample button[/btn_big]

If you want change button background color, add the attribute background="#000" to shortcode:

[btn_big url="" target="_blank" background="#000"]Sample button[/btn_big]