I set up an admin settings menu and I'd like to output the fields as a short code.
The way I learned to output the fields from a tutorial was with:
<?php $input_examples = get_option('sandbox_theme_input_examples'); ?>
<?php echo sanitize_text_field( $input_examples[ 'textarea_example' ] ); ?>
But putting that into the shortcode doesn't work:
function shortcode()
{
return '<?php $input_examples = get_option('sandbox_theme_input_examples'); ?>';
return '<?php echo sanitize_text_field( $input_examples[ 'textarea_example' ] ); ?>';
}
add_shortcode('shortcode', 'shortcode');
I'm guessing there is a specific way to put php code into the shortcodes that I'm not understanding?
I've looked all over and can't find a solution to this.