简体   繁体   中英

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.

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

if($query->have_posts()){
    while($query->have_posts()){
        $query->the_post();

        $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>'; 
    }
}   
wp_reset_postdata();
return  $circular_slider;
}
?>

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

http://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage

Give the style property -ms-word-wrap: break-word; word-wrap: break-word; -ms-word-wrap: break-word; word-wrap: break-word;

.ca-item .ca-item-1 {
    line-height:enter code here 1.6em;
    margin: 0.4em 0;
    -ms-word-wrap: break-word;
    word-wrap: break-word; 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM