Image 如何添加图像url作为项目子项馈送?

Image 如何添加图像url作为项目子项馈送?,image,wordpress,feed,Image,Wordpress,Feed,有没有办法将缩略图url添加到wordpress提要 我知道如何将缩略图添加到内容中,但我需要rss提要在另一个域上布局页面。所以我想使用$item->get_title(),$item->get_description()和类似$item->get_image\u url的缩略图 在other domain.com上,我使用以下内容(other domain.com也是WP安装) require('../../../site/wp load.php'); 包括一次(ABSPATH.WPINC.

有没有办法将缩略图url添加到wordpress提要

我知道如何将缩略图添加到内容中,但我需要rss提要在另一个域上布局页面。所以我想使用$item->get_title(),$item->get_description()和类似$item->get_image\u url的缩略图

在other domain.com上,我使用以下内容(other domain.com也是WP安装)

require('../../../site/wp load.php');
包括一次(ABSPATH.WPINC.'/feed.php');
$rss=fetch_feed('domain.com/feed/?post_type=recipes');
foreach($rss->get_items()作为$item){
echo$item->get_title()。
。$item->get_description(); 回声“
”; }
有什么建议吗?

如果您想要图像url(src)

您必须首先使用获取拇指id,然后使用获取图像src

<?php
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
$image_src = wp_get_attachment_image_src( $post_thumbnail_id , $size, $icon ); 
?>


tx,但我试过了。该函数主要用于向rss提要$item->descreption添加图像。在我的例子中,我想,我喜欢在SimplePie中添加一个节点。如果我理解正确的话,WP在rss提要中使用了某种simplepie格式,但我似乎没有包括图像。我尝试获取图片url();啊,好的,我知道你要去哪里了,我有原始的img src,带有
$image\u src=wp\u get\u attachment\u image\u src($post\u thumbnail\u id,'full')
但我仍然不知道如何使用
add_filter('the_content_feed'、'rss_post_缩略图')将这个url放入rss提要中;函数rss_post_缩略图($content){global$post;if(has_post_缩略图($post->ID))$post_缩略图\u ID=get_post_缩略图($post->ID);$image_src=wp_get_attachment_image_src($post_缩略图,'full');//将$image_src[0]放入rss提要的何处?$content=''.$image_src[0].

'.$content;返回$content;}
您能用上次更新编辑您的问题吗,因为注释中的代码不可读:)嗨,布查拉,嗯,不能再编辑了。我喜欢完成的是添加
$image\u src=wp\u get\u attachment\u image\u src($post\u thumbnail\u id,'full')的值
在rss提要中作为一个单独的节点,而不是作为内容节点的一部分。仅供参考:我现在正在编辑wp includes/feed-rss2.php,尽管我想将其添加到functions.php中,并保持feed-rss2.php不变。
<?php
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
$image_src = wp_get_attachment_image_src( $post_thumbnail_id , $size, $icon ); 
?>