Support » Plugin: OptionTree » [Plugin: OptionTree] Support for php/shortcode

  • Resolved nlsubtitles



    Been using the plugin for 2 weeks now and I really love it, it’s great for customizing themes in all kinds of ways!

    I just tried to implement Adrotate via Optiontree Textarea_simple.
    The code just displays on the site like text. I tried some things with return ot_get_option instead of echo but I can’t get it to work.

    I think I can understand why it’s not working, the adrotate functionname is echoed and that’s it. It needs to read that line php a second time to actually run the function or something?
    Probably talking gibberish:D

    So is there any way to get this to work?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Derek Herman


    There is no support for php or shortcodes in the textarea. However, a quick fix for the shortcodes is to run the output of the textarea through the do_shortcode() function. PHP on the other hand is a much more complicated venture.

    Works perfect! Thanks again Derek!!

    Could you provide a php example of this. How do you merge a do shortcode and an option tree function.
    <?php echo get_option_tree(‘frontpage_featurerow_text’); ?>
    <?php echo do_shortcode( $frontpage_featurerow_text); ?>

    Plugin Author Derek Herman


    First you would not echo it, you’d save it as a variable and then pass that to do_shortcode or something like this:

    `<?php echo do_shortcode( get_option_tree( ‘frontpage_featurerow_text’ ) ); ?>

    That should work. It’s not tested, but should anyhow.


    This worked for me but with some issues. They may not have to do with Option Tree but I hope someone can at least help me narrow down where the problem lies.

    When I am not logged in the content of the shortcode is only sometimes displayed. Also, from that point down the document is not rendered! When I remove the shortcode from the option tree option field, the document fully renders when not logged in.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: OptionTree] Support for php/shortcode’ is closed to new replies.