mozmeao / foxtail

new Wordpres theme for the Firefox content portal
3 stars 2 forks source link

Add co-authors to RSS feed #40

Closed craigcook closed 5 months ago

craigcook commented 5 months ago

The Co-Authors Plus plugin allows shared bylines as well as display-only guest authors, but the default WordPress feed template doesn't show them. We need to add a custom filter to change the feed author as well. This function from https://wordpress.org/support/topic/coauthor-in-rss-feed-fix/ is probably a good place to start (I haven't tested yet).


* Co-authors in RSS and other feeds
* /wp-includes/feed-rss2.php uses the_author(), so we selectively filter the_author value
*/
function db_coauthors_in_rss( $the_author ) {

    if ( !is_feed() || !function_exists( 'coauthors') ){
        #return coauthors__echo( null, null, null, null, false );
        return $the_author;
    }
    else{
        #return "hey hey hey";
        return coauthors( null, null, null, null, false );
    }

}
add_filter( 'the_author', 'db_coauthors_in_rss');```