Post loop created via shortcode not displaying shortcode in content

I’ve been racking my brain on this. Here is a shortcode loop I’ve created to display a specific post type:

    function faq_shortcode($atts, $content = NULL) {
        extract(shortcode_atts(array(
            'faq_topic' => '',
            'faq_tag'   => '',
            'faq_id'    => '',
            'limit'     => '10',
        ), $atts));
        $faq_topic = preg_replace('~&#x0*([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $faq_topic);
        $faq_tag = preg_replace('~&#x0*([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $faq_tag);
            $faqs = new WP_Query(array(
                'p'                 => ''.$faq_id.'',
                'faq-topic'         => ''.$faq_topic.'',
                'faq-tags'          => ''.$faq_tag.'',
                'post_type'         =>  'question',
                'posts_per_page'    =>  ''.$limit.'',
                'orderby'           =>  'menu_order',
                'order'             =>  'ASC'
                ));
            $displayfaq= '<div class="faq_list">';
                while ($faqs->have_posts()) : $faqs->the_post();
                $displayfaq .= '<div class="single_faq">';
                $displayfaq .= '<h3 class="faq_question">'.get_the_title().'</h3>';
                $displayfaq .= '<p class="faq_answer">'.get_the_content().'</p>';
                $displayfaq .= '</div>';
                endwhile;
            wp_reset_query();
            $displayfaq .= '</div>';
        return $displayfaq;
        }

add_shortcode('faq','faq_shortcode');

within one of those loops there is a post that has a shortcode being used

Read More
function emailbot_ssc($atts, $content = null) {
        extract( shortcode_atts( array(
        'address' => '',
            ), $atts ) );
        ob_start();
        echo '<a href="mailto:'.antispambot($atts['address']).'" title="email us" target="_blank" rel="nofollow">'.$atts['address'].'</a>';
        $email_ssc = ob_get_clean();
        return $email_ssc;
        }
add_shortcode("email", "emailbot_ssc");

the FAQ loop (code item #1) isn’t parsing the shortcode. It just displays it raw.

Related posts

Leave a Reply

1 comment

  1. get_the_content() does not have the the_content filters applied to it, which is where do_shortcode() is hooked in. Those filters are only applied in the_content(). Those two functions are not simply get/echo versions of each other. get_the_content() is lower level.

    This is an anomaly in the API, and is that way for historical reasons. For instance, get_the_title() applies the the_title filters.

    If you want the whole the_content filter stack applied, do:

    apply_filters( 'the_content', get_the_content() )
    

    If you only want shortcodes applied, do:

    do_shortcode( get_the_content() )