Add filters to `feed_links()` to choose whether to display the links to posts feed and comments feed, separately.

props joostdevalk, juliobox.
fixes #23692.

git-svn-id: https://develop.svn.wordpress.org/trunk@33838 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-09-01 02:45:58 +00:00
parent 57a7ed15a7
commit 357bd80a0b
1 changed files with 21 additions and 2 deletions

View File

@ -2306,8 +2306,27 @@ function feed_links( $args = array() ) {
$args = wp_parse_args( $args, $defaults );
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n";
/**
* Filter whether to display the posts feed link.
*
* @since 4.3.0
*
* @param bool $show Whether to display the posts feed link. Default true.
*/
if ( apply_filters( 'feed_links_show_posts_feed', true ) ) {
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
}
/**
* Filter whether to display the comments feed link.
*
* @since 4.3.0
*
* @param bool $show Whether to display the comments feed link. Default true.
*/
if ( apply_filters( 'feed_links_show_comments_feed', true ) ) {
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n";
}
}
/**