Ready to get started?Download WordPress


[resolved] Support for php/shortcode (6 posts)

  1. nlsubtitles
    Posted 2 years ago #


    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?


  2. Derek Herman
    Plugin Author

    Posted 2 years ago #

    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.


  3. nlsubtitles
    Posted 2 years ago #

    Works perfect! Thanks again Derek!!

  4. davidjs
    Posted 1 year ago #

    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); ?>

  5. Derek Herman
    Plugin Author

    Posted 1 year ago #

    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.

  6. patrickd
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.