您可以将此部分添加到函数中:
$audios =& get_children(\'post_type=attachment&post_parent=\'.$post->ID.\'&post_mime_type=audio\' );
foreach ( $audios as $id => $audio ){
$content.=\'<a href="\'.wp_get_attachment_url($id).\'" target="_blank">\'.$audio->post_title.\'</a> \';
}
将音频链接添加到提要内容中。
我正在使用get_children()
在这里,您可以在这里阅读更多信息:
http://codex.wordpress.org/Function_Reference/get_children
Edit:
以下是整个功能:
function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = \'\' . get_the_post_thumbnail( $post->ID, \'topImage\', array( \'style\' => \'margin:0 auto; border: 1px solid #555; display:block;\' ) ) . \'\' . $content;
}
$audios =& get_children( \'post_type=attachment&post_parent=\'.$post->ID.\'&post_mime_type=audio\' );
foreach ( $audios as $id => $audio ){
$content.=\'<a href="\'.wp_get_attachment_url($id).\'" target="_blank">\'.$audio->post_title.\'</a> \';
}
return $content;
}
add_filter(\'the_excerpt_rss\', \'featuredtoRSS\');
add_filter(\'the_content_feed\', \'featuredtoRSS\');