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

  • Resolved maven1129

    (@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 months, 2 weeks ago by maven1129.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Bas Schuiling

    (@basszje)

    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.

    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

    (@basszje)

    In PHP it would simply be like this:

    <?php 
    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.