Title: Shortcode Attribute : URL
Last modified: April 21, 2020

---

# Shortcode Attribute : URL

 *  Resolved [maven1129](https://wordpress.org/support/users/maven1129/)
 * (@maven1129)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/shotcode-attribute-url/)
 * 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 6 years, 1 month ago by [maven1129](https://wordpress.org/support/users/maven1129/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Bas Schuiling](https://wordpress.org/support/users/basszje/)
 * (@basszje)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/shotcode-attribute-url/#post-12711589)
 * 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](https://wordpress.org/support/users/maven1129/)
 * (@maven1129)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/shotcode-attribute-url/#post-12731107)
 * 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](https://wordpress.org/support/users/basszje/)
 * (@basszje)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/shotcode-attribute-url/#post-12739473)
 * 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.
    -  This reply was modified 6 years, 1 month ago by [Bas Schuiling](https://wordpress.org/support/users/basszje/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Shortcode Attribute : URL’ is closed to new replies.

 * ![](https://ps.w.org/maxbuttons/assets/icon-128x128.png?rev=1378636)
 * [MaxButtons - Create buttons](https://wordpress.org/plugins/maxbuttons/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/maxbuttons/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/maxbuttons/)
 * [Active Topics](https://wordpress.org/support/plugin/maxbuttons/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/maxbuttons/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/maxbuttons/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 3 replies
 * 2 participants
 * Last reply from: [Bas Schuiling](https://wordpress.org/support/users/basszje/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/shotcode-attribute-url/#post-12739473)
 * Status: resolved