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.

I built a plugin, and I would like to use shortcodes in the integrated wp_editor.

I'm using echo to display the content of the wp_editor, so I think that's the problem why I can't use the shortcode. What's the method to do that?

I'm using the following code for shortcode:

add_shortcode('facebook', 'facebook');

function facebook($atts) {
    $options = get_option( 'social_options' );
    return '<a class="socialmedia socialfacebook" href="'.$options["facebook"].'">Facebook</a>';
}

..and the following code to get the content of the wp_editor:

<?php
    $footer = get_option('footer_options');
    $footer_content = array($footer['footer_content_1'], $footer['footer_content_2']);
    foreach($footer_content as $content) {
        echo'<aside class="tab-content">
            '.$content.'
        </aside>';
    }
?>
share|improve this question

1 Answer 1

up vote 2 down vote accepted

try doing this

 <?php
$footer = get_option('footer_options');
$footer_content = array($footer['footer_content_1'], $footer['footer_content_2']);
foreach($footer_content as $content) {
 $content = apply_filters('the_content', $content);
    echo'<aside class="tab-content">
        '.$content.'
    </aside>';
}
 ?>

I once had the same issue and applying the content filter solved it

share|improve this answer
    
amazing, thanks –  robert Mar 16 '13 at 19:28
    
You're welcome. –  Jamie Mar 16 '13 at 19:47

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.