我正在使用Wordpress中的收藏插件来保存帖子。不过,我正试图调整信息的显示方式。所有的造型等工作以下和我的div是包括在内,但我正在努力拉信息通过填补div。前面的例子,我试图把摘录拉到p.details,但它只是抛出一个空的结果,没有错误。类似地,我试图通过一个acf自定义字段‘but’进入p.bath,但这也是空的。有什么建议吗?提前谢谢。
if ( is_multisite() ) switch_to_blog($this->site_id);
$out = '<ul class="property-list" data-userid="' . $this->user_id . '" data-links="true" data-siteid="' . $this->site_id . '" ';
$out .= ( $include_button ) ? 'data-includebuttons="true"' : 'data-includebuttons="false"';
$out .= ( $this->links ) ? ' data-includelinks="true"' : ' data-includelinks="false"';
$out .= ' data-nofavoritestext="' . $no_favorites . '"';
$out .= ' data-posttype="' . $post_types . '"';
$out .= '>';
foreach ( $favorites as $key => $favorite ){
$out .= '<li data-postid="' . $favorite . '">';
$out .= '<div class="third-1">';
$out .= '<a class="property-thumb" href="' . get_permalink($favorite) . '">';
$out .= '</a>';
$out .= '</div>';
$out .= '<div class="third-2">';
if ( $this->links ) $out .= '<h3 class="name"><a href="' . get_permalink($favorite) . '">';
$out .= get_the_title($favorite);
if ( $this->links ) $out .= '</a></h3>';
if ( $this->links ) $out .= '<h4 class="price">';
$out .= '£' . '300';
if ( $this->links ) $out .= '</h4>';
if ( $this->links ) $out .= '<p class="details">';
$out .= the_excerpt();
if ( $this->links ) $out .= '</p>';
if ( $this->links ) $out .= '<p class="bed">';
$out .= '1';
if ( $this->links ) $out .= '</p>';
if ( $this->links ) $out .= '<p class="bath">';
$out .= '1';
if ( $this->links ) $out .= '</p>';
if ( $this->links ) $out .= '<a class="full-details" href="' . get_permalink($favorite) . '">';
$out .= 'Full details';
if ( $this->links ) $out .= '</a>';
if ( $this->links ) $out .= '<a class="book-viewing" href="' . get_permalink($favorite) . '">';
$out .= 'Book Viewing';
if ( $this->links ) $out .= '</a>';
$out .= '</div>';
$out .= '</li>';
}发布于 2015-10-09 13:19:18
将the_excerpt();更改为get_the_excerpt();,它应该可以工作。
https://stackoverflow.com/questions/33037028
复制相似问题