Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to display shortcode content outside of the_content?

I am building a custom theme who's theme options includes two text boxes that can be displayed on the front page. I want to be able to display shortcode content placed in these text box options. The theme uses files from the Options Framework.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use the function do_shortcode() for use shortcodes outside fomr default content. You can also parse this in your function, there get the output of your textfields, like the follow example for a custom field:

if ( get_post_meta( $post->ID, 'cfield', TRUE ) )
    echo do_shortcode( get_post_meta( $post->ID, 'cfield', $single = TRUE ) );
share|improve this answer
    
Thanks @bueltge. The shortcode is not part of a post. It is part of the theme options. –  Steve Jan 13 '13 at 12:13
    
The function works in all fields, also in your theme options. –  bueltge Jan 13 '13 at 13:06
2  
@Steve, do_shortcode( get_option(etc... –  brasofilo Jan 13 '13 at 14:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.