Support » Plugin: WordPress Shortcodes Plugin — Shortcodes Ultimate » Creating a QRcode with current URL as data – nested shortcodes

  • Resolved mallard66



    I’m trying to create a QR code using the su_qrcode shortcode. I want the QR code to be “dynamic” and show the URL of the page it’s being displayed on. I’d then put that in a widget and if the reader prints a pdf copy of the post, the QR code would be printed as well.

    I’ve tried to nest su_qrcode with su_post like this:

    [su_qrcode data="{su_post field='ID' before=''}" ]

    This just interprets the data attribute as

    {su_post field='ID' before=''}

    I’ve also tried using the double underscore, as indicated by an older posting. Has anyone been able to get something like this working?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there
    I have created a function to display information dynamically in my functions.php

    <?php echo do_shortcode('[su_qrcode data="'.get_the_author_meta('first_name').' - '.get_the_author_meta('description').' Web - '.get_the_author_meta('url').' Email - '.get_the_author_meta('company_email').' Phone - '.get_the_author_meta('contact_tel1').'" title="Visit '.get_the_author_meta('first_name').' Website" link="'.get_the_author_meta('url').'" align="center"]'); ?>

    potentially you could perhaps do the same?

    [su_qrcode data="'.the_ID().'" ]

    Not sure if that will work

    Hi markedwardford,

    that helped me get it right. I’m using the plugin “Post Snippets” which allows me to embed short php snippets as shortcodes. Here’s what I needed to do:

    $data_id_string = "" . get_the_ID();
    echo do_shortcode("[su_qrcode data=$data_id_string size='80' margin='10']");

    That’s it. Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating a QRcode with current URL as data – nested shortcodes’ is closed to new replies.