带有$ out

时间:2015-10-09 11:23:07

标签: php wordpress echo advanced-custom-fields

我在Wordpress中使用收藏夹插件来保存帖子。我试图调整信息的显示方式。所有的样式等都在下面工作,我的div正在被包括在内,但是我正努力通过填充信息来填补div。例如,我试图将摘录拉入p.details,但它只是抛出一个空的结果,没有错误。同样地,我试图通过一个acf自定义领域' bath'进入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>';
    }

1 个答案:

答案 0 :(得分:1)

the_excerpt();更改为get_the_excerpt();工作。