Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Shortcodes in Options Panel textareas WordPress

I am using an Options Panel to create my themes, and I would like to make the textareas from this OP to support my shortcodes too.

The code for that creates the textarea fields:
case 'textarea':
$cols = '8';
$ta_value = '';

if(isset($value['options'])) {
$ta_options = $value['options'];
if(isset($ta_options['cols'])) {
$cols = $ta_options['cols'];

$ta_value = stripslashes($data[$value['id']]);

$output .= '<textarea class="of-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';

Any idea how can I do that?

Please let me know if I should provide more details. Thanks.

For example, I will show you how the shortcodes are allowed in the footer's text area trough a textarea from my theme's options panel.

function thematic_siteinfo() {
global $options, $blog_id;
foreach ($options as $value) {
if (get_option( $value['id'] ) === FALSE) {
$$value['id'] = $value['std'];
} else {
$$value['id'] = get_blog_option( $blog_id, $value['id'] );
} else {
$$value['id'] = get_option( $value['id'] );
/* footer text set in theme options */
echo do_shortcode(__(stripslashes(thematic_footertext($thm_footertext)), 'thematic'));
add_action('thematic_footer', 'thematic_siteinfo', 30);

function thematic_footertext($thm_footertext) {
$thm_footertext = apply_filters('thematic_footertext', $thm_footertext);
return $thm_footertext;

As you can see there was used:
echo do_shortcode(__(stripslashes(thematic_footertext($thm_footertext)), 'thematic'));

And with this one I am making it work with my options panel:

function childtheme_footer($thm_footertext) {
global $data;
if ($footertext = $data['my_footer_text'])
return $footertext;
add_filter('thematic_footertext', 'childtheme_footer');

I have found a solution but I don't like it too much. If I wrap into do_shortcode() an option that belongs to a textarea, than the shortcodes are working. But I don't want to write everytime do_shortcode($my_textarea_option), I would rather wrap the textarea somehow. do_shortcode($ta_value) is not working.

I have found the solution I was looking for. I will not ask for a refund, because it's my first question and I want to be trusted further.
So, as I still want to reward someone, I will reward the one that will come with the best working solution.

Answers (5)


Arnav Joy answers:

can you explain some more points what are you looking for any example would be great.

bogh comments:

Please see my update. Thanks.


Jeffri Hong answers:

Shortcodes are parsed in front-end request by using the function do_shortcode.

Basically, to make the shortcodes work, when you print the text from that textarea, you passed using do_shortcode($text).

bogh comments:

I know that I have to use the do_shortcode, and I think I have also to use stripslashes somehow, so it allows my html code too. I will post an example of how it was done to make the footer text to support shortcodes trough this admin panel.


paul de wouters answers:

bogh comments:

I have tried now to wrap $ta_value like do_shortcode($ta_value) but nothing happens.


Andrew Wong answers:

Try to use the default WordPress visual editor (wp_editor) instead?

bogh comments:

Thanks, but this is not a good option for me now.


Francisco Javier Carazo Gil answers:

You have to do something like this:

$string = 'This is my string [myshortcode term="domain"]';

echo apply_filters('my_parse_shortcode',$string);


Where string is $ta_value