Need shortcode functionality in custom Theme Options
-
I am developing my own theme and just started building its own “Theme Options”. There are 3 “<textarea>” blocks that grab the data from it and output it to the page in the footer area. One of them is the “Copyright” section.
I made a “[year]” shortcode and when I type it in the “<textarea>” under Theme Options, it just outputs it as “[year]” instead of “2012” on the website.
I know I have to add some sort of filter to allow shortcodes, but I don’t know where. I’ve tried a few methods but I just can’t get it to work.
Any help appreciated.
functions.php
function currentYear() { the_time('Y'); } add_shortcode('year', 'currentYear');
theme-options.php
<p class="text-option"><?php _e( 'Left Footer Content:', 'jframe' ); ?> <textarea id="jframe_theme_options[leftfootercontent]" class="large-text" cols="50" rows="5" name="jframe_theme_options[leftfootercontent]"><?php echo esc_textarea( $options['leftfootercontent'] ); ?> </textarea> <label><em>Content for left side of the footer.</em></label> </p>
footer.php
<p class="copyright"> <?php if ( isset( $options['leftfootercontent'] ) ) { echo $options['leftfootercontent']; } ?> </p>
- The topic ‘Need shortcode functionality in custom Theme Options’ is closed to new replies.