joydev joydev - 1 year ago 39
PHP Question

the_content() is showing outside the div

I am using the following function to show content. The content is showing properly but outside of the div.

function show_post(){
$query = new WP_Query(array('post_type' => 'circular', 'post_per-page' => -1));


$circular_slider .= '<div class="ca-item ca-item-1"><div class="ca-item-main"><div class="ca-icon"></div><p>';
$circular_slider .= ''.the_content().'';
$circular_slider .= '</p></div></div>';
return $circular_slider;

Answer Source

the_content outputs the content directly – you want to use get_the_content instead, because that returns the content.