Support » Plugins » Outputting short code in widget

  • Resolved martin


    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]

    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.

    echo do_shortcode(‘[popup url=””]LINK TEXT[/popup]’);

    The above isn’ even using variables, but always produces the following error:
    Parse error: syntax error, unexpected T_STRING in /www/doc/ : eval()’d code on line 11

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

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

    <?php $width = 100; ?>
    [popup url="" width="<?php echo $width; ?>"]LINK TEXT[/popup]

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



    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,

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