• Resolved martin

    (@martinmares)


    I have spent a lot of time on this now, hope for help.
    I have Simple Popup Plugin, and I have used it in 2 different php widgets with the same error, so it’s got to be me and not the widget.

    The following short code works beautifully in both php widgets and text widget:
    [popup url=”/waxing/popupwax.html” width=”270″ height=”600″]<p style=”font-size:16px; font-style: italic”>Before and After Photos</p>[/popup]

    HOWEVER,
    I would very much like to use variables for url, width, height rather than hard coding it.
    From docs it seems I should use do_shortcode() to do this.

    <?php
    echo do_shortcode(‘[popup url=”https://popupurl.com”%5DLINK TEXT[/popup]’);
    ?>

    The above isn’ even using variables, but always produces the following error:
    Parse error: syntax error, unexpected T_STRING in /www/doc/www.beautysecrets.cz/www/wp-content/plugins/enhanced-text-widget/enhanced-text-widget.php(42) : eval()’d code on line 11

    I have tried so many variations and always the same.
    Thaks for your time,
    martin

Viewing 2 replies - 1 through 2 (of 2 total)
  • Above code should work…
    try to use something like this

    <?php $width = 100; ?>
    [popup url="https://popupurl.com" width="<?php echo $width; ?>"]LINK TEXT[/popup]

    [Please post code snippets between backticks or use the code button.]

    Thread Starter martin

    (@martinmares)

    Yep, that will be a nice hack for me, not sure why do_shortcode falls short but I am going to move on!
    Thanks a lot Oleg,
    martin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Outputting short code in widget’ is closed to new replies.