WordPress.org

Forums

scbFramework
[resolved] Shortcodes with html() (5 posts)

  1. gillespieza
    Member
    Posted 2 years ago #

    Is there a way to parse shortcodes with html()? Or is there another way I could make a shortcode render on an options page?

    http://wordpress.org/extend/plugins/scb-framework/

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. gillespieza
    Member
    Posted 2 years ago #

    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)

  4. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    This should work:

    $content = do_shortcode( 'Click on this [permalink id="123"]link[/permalink] for more information.' );
    
    echo html( 'p', $content );
  5. gillespieza
    Member
    Posted 2 years ago #

    Fabulous, thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags