php – 照片RSS Feed显示
发布时间:2020-12-13 16:16:53  所属栏目:PHP教程  来源:网络整理 
            导读:我有一个wordpress博客 http://cgvector.com,我想在RSS Feed中显示精选图像.我怎样才能做到这一点?我的Feed地址是: http://feeds.feedburner.com/cgvector 我已添加此代码,但它无法正常工作. function featuredtoRSS($content) { global $post; if ( has_p
                
                
                
            | 
 我有一个wordpress博客 
 http://cgvector.com,我想在RSS Feed中显示精选图像.我怎样才能做到这一点?我的Feed地址是: 
 http://feeds.feedburner.com/cgvector 
  
  我已添加此代码,但它无法正常工作. function featuredtoRSS($content) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
    $content = '' . get_the_post_thumbnail( $post->ID,'thumbnail',array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content;
    }
    return $content;
}
add_filter('the_excerpt_rss','featuredtoRSS');
add_filter('the_content_feed','featuredtoRSS');解决方法function custom_feed($content) {
    return wp_get_attachment_image(get_post_thumbnail_id(),'full') . '<br />' . $content;
}
add_filter('the_content_feed','custom_feed');这个应该为你做的伎俩…… (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! | 
