我在我的magento中使用wordpress,使用Fishpig wordpress扩展,我在functions中创建了一个函数。我的主题的php(虽然它是完全集成的,这意味着magento主题应用于博客),但下面的函数似乎没有任何作用。我的职能是
add_filter( \'the_excerpt_rss\', \'insert_thumbnail_into_feed\' );
add_filter( \'the_content_feed\', \'insert_thumbnail_into_feed\' );
function insert_thumbnail_into_feed() {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
// replace thumbnail with yours
$content = \'<p>\' .get_the_post_thumbnail( $post->ID, \'thumbnail\' ) .\'</p>\';
}
// get post content and replace feed content with
// you can also limit/filter the content to exclude shortcodes and html code etc.
$content .= \'<p>\' .get_the_content() .\'</p>\';
return $content;
}
是因为feed默认加载rss,而rss不运行上述代码吗?编辑:我正在使用此
Fishpig 扩大