WordPress.org

Ready to get started?Download WordPress

Forums

MaxButtons: WordPress Button Generator
[resolved] Using same button to link to many URLs (6 posts)

  1. danallen
    Member
    Posted 1 year ago #

    Is it possible to use the same button many times with different URLs linked to it in each instance? I'd like to use the same "Buy now on Amazon" button for many different products without having to create a unique button for every individual item, since it will look exactly the same. I tried overriding the button's properties with the basic WordPress linking feature, but that seems to have no effect on the preset URL link attached to the button. And when I remove any preset link, the button links simply to the post's own URL.

    http://wordpress.org/extend/plugins/maxbuttons/

  2. maxfoundry
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, you can do this with a little PHP and the url parameter for the button shortcode, as such:

    <?php echo do_shortcode('[maxbutton id="17" url="http://website.com/"]') ?>

    Change the ID, of course, then replicate this code where you need it, passing in a different url.

  3. CharlieLivingston
    Member
    Posted 1 year ago #

    Sorry for being slow, but where exactly would you put that PHP code? I tried adding it to the text editor of a post but that didn't work (nothing happened).

    Thanks.

    My site is http://reswpthemes.com, if you want to take a look.

  4. maxfoundry
    Member
    Plugin Author

    Posted 1 year ago #

    You have to edit your theme's template files to use that PHP code.

  5. maxfoundry
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry, forgot to mention that you can also do this without editing theme files. Just use the shortcode as such in any content:

    [maxbutton id="17" url="http://website.com"]

    Then reuse that shortcode with the same button id elsewhere, changing the url parameter as needed.

  6. johnbhartley
    Member
    Plugin Author

    Posted 1 year ago #

    Marking as resolved. Happy to re-open if you're still having problems.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags