редактор wp не добавляет абзацы, несмотря на то, что для параметра wpautop установлено значение true


Я использую следующий код для создания экземпляра wp_editor:

<?php if (version_compare($wp_version, "3.3") >= 0) { ?>
    <p><?php wp_editor(  $answer->post_content, 'answer', array( 'media_buttons' => true, 'wpautop' => true ) ); ?></p>
<?php } else { ?>
    <p><textarea name="answer" class="wp32"><?php echo esc_textarea( $answer->post_content ); ?></textarea></p>
<?php } ?>

Однако по какой-то причине ответ содержимое не отображается с абзацами.

HTML для вопроса содержание:

<div id="question-content"><p>I am somehow missing it.&nbsp;&nbsp; When I go to the “Knowledge Base” and click on “Tetras”</p>
<p>I get one page of tetra descriptions starting with the “A”s.</p>
<p>How do I get to the next page????</p>
</div>

Но содержимое HTML для ответа таково:

<div class="answer-content">
                Hi Jim,

The Tetras that you're seeing there are currently the only Tetras marked as being in that group!

Matt is working fervently to update the species database to our new website format, so at the moment, not every species is marked as being in the correct Knowledge Base groups.

Please bear with us!            </div>

РЕДАКТИРОВАТЬ: Распечатка содержимого ответа

    foreach ( $answers->posts as $answer ) {
        setup_postdata( $answer );
?>
    <div id="answer-<?php echo $answer->ID; ?>" class="answer">
        <?php the_answer_voting( $answer->ID ); ?>
        <div class="answer-body">
            <div class="answer-content">
                <?php echo get_the_content(); ?>
            </div>

            <div class="answer-meta">
                <?php the_qa_action_links( $answer->ID ); ?>
                <?php the_qa_author_box( $answer->ID ); ?>
            </div>
        </div>
    </div>
<?php

Есть идеи?

Заранее благодарю,

Author: turbonerd, 2012-05-06

1 answers

Использовать the_content() не echo get_the_content();.

Как вы можете видеть в wp-includes/default-filters.php wpautop добавляется для фильтра 'the_content', который вызывается в the_content().

 6
Author: fuxia, 2012-05-06 16:06:03