WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Shortcodes with html()

[Resolved] Shortcodes with html()

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author scribu
    Member

    @scribu

    I have no idea what you’re asking or why you would need what you’re asking.

    Please post a more thorough explanation of the use case, and maybe some example code in a pastebin to go along with it.

    gillespieza
    Participant

    @gillespieza

    So, for example, if I had a [permalink] shortcode function defined elsewhere (perhaps in my actual plugin functions file), and in an options page I wanted to output some html like:

    <p>Click on this [permalink id="123"]link[/permalink] for more information.</p>

    if I use
    echo html( 'p', 'Click on this [permalink id="123"]link[/permalink] for more information.' );
    then the shortcode doesn’t render, it just displays the text exactly as is

    (I know permalink is a bad example because how would I know the ID to be linking to, but I couldn’t think of another example offhand)

    Plugin Author scribu
    Member

    @scribu

    This should work:

    $content = do_shortcode( 'Click on this [permalink id="123"]link[/permalink] for more information.' );
    
    echo html( 'p', $content );
    gillespieza
    Participant

    @gillespieza

    Fabulous, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Shortcodes with html()’ is closed to new replies.