【发布时间】:2025-12-31 15:05:06
【问题描述】:
function recent_posts_function() {
$call_number = the_field('call_number');
$book_author = the_field('book_author');
$publisher = the_field('publisher');
$edition = the_field('edition');
$description = the_field('description');
$subjects = the_field('subjects');
query_posts(array('post_type' => 'model', 'orderby' => 'date', 'order' => 'ASC' , 'showposts' => 5));
if (have_posts()) :
while (have_posts()) : the_post();
echo
'<div class="book-list-section">'
'<h3>' .$call_number '</h3>'
'</div>';
endwhile;
endif;
wp_reset_query();
}
这是 wordpress,但我的问题是我无法正确连接 html 代码并回显它。请帮助我,我搜索并尝试过但仍然不知道...
function recent_posts_function() {
query_posts(array('post_type' => 'model', 'orderby' => 'date', 'order' => 'ASC' , 'showposts' => 5));
if (have_posts()) :
while (have_posts()) : the_post();
echo
'<div class="book-list-section">
<h3>'.the_field(call_number).'</h3>
<p><span>'.get_the_title().'</span></p>
<br class="clear" />
<p>' .the_field('book_author').'</p>
<br class="clear" />
<p>' .the_field('publisher').'</p>
<p>' .the_field('edition'). '</p>
<p>' .the_field('description').'</p>
<br class="clear" />
<p>' .the_field('subjects'). '</p>
</div>';
endwhile;
endif;
wp_reset_query();
}
它正在工作,但它不在 div 内......这是为什么呢? "get_the_title()" 只是 DIV 中的那个……这有什么问题?
【问题讨论】:
标签: php wordpress concatenation