Support » Plugin: WordPress Button Plugin MaxButtons » Shortcode Attribute : URL

  • Resolved maven1129


    I see that you offer the ability to reference a shortcode attribute in the button link. How would I use the content of a custom field of the post the button is showing up on as the text content of the button, and another custom field as the URL for the button link?

    • This topic was modified 2 years, 3 months ago by maven1129.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Bas Schuiling


    The most likely way to do this via a custom PHP snippet or function, which creates the URL and puts it in the shortcode.

    You can use the shortcodes via the ‘do_shortcode’ function.

    Thread Starter maven1129


    You would just put the php directly into the field itself? If you woudlnt mind giving us the full php or method, that would be really helpful since it is an option in your plugin without any reference to how to use it 🙂

    Plugin Author Bas Schuiling


    In PHP it would simply be like this:

    do_shortcode('[maxbutton id="x" url="' . $url . '"]'); 

    This assuming X is your button_id (probably better to use button name in code, so you can change the butotn later ) and the $url is the URL you want to put in the button and have loaded from somewhere.

    This you would put in a child templates / functions.php or whatever.

    • This reply was modified 2 years, 3 months ago by Bas Schuiling.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode Attribute : URL’ is closed to new replies.