• Hello,

    I need to create a button whose URL is populated dynamically. Specifically I want the link to contain some url parameters taken from the url parameters from the current page. I tried using this plugin: https://wordpress.org/plugins/url-params/ which works great, but unfortunately it seems that I can not use shortcode inside of the button’s url field. How can I resolve this?

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Bas Schuiling

    (@basszje)

    This is something that needs to be solved with some code I’m afraid.

    You can use shortcodes within templates to get the URL you require, something like this :

    $param = sanitize_text_field($_GET['param']);
    echo do_shortcode("[maxbutton id=1 url="http://example.com?param=$param]"); 

    There is also a filter in maxbuttons for URL’s called ‘mb-url’ and ‘mb-url-x’ , where the X is for button_id, so you can filter per button.

    I’m not sure what you are trying to do, but those might help.

Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic button URL’ is closed to new replies.