Support » Plugin: OptionTree » How to add the output of an ot_option to a shortcode string

  • Forgive me if this is seems simple, but I’m learning πŸ˜‰

    I’m trying to add a series of ot_options outputs to a string in a shortcode, but having a bit of trouble.
    My ot_option works fine when placed in template like so: echo get_option_tree( $id );, but doesn’t work in shortcode like so:

    function my_shortcode() {
        echo '<li>Value 1:';
        echo get_option_tree( 'value1' );
        echo '</li>;
    
        echo '<li>Value 2:';
        echo get_option_tree( 'value2' );
        echo '</li>;
    }
    add_shortcode('myshortcode', 'my_shortcode');

    Obviously I get the markup and text, but not the values stored in the get_option_tree function.

    Any advice is greatly appreciated, thanks!

    https://wordpress.org/plugins/option-tree/

  • The topic ‘How to add the output of an ot_option to a shortcode string’ is closed to new replies.