feed_links_extra() DRY, props scribu, fixes #9291
git-svn-id: https://develop.svn.wordpress.org/trunk@10741 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5c0e3673e8
commit
88cae82656
|
@ -1444,29 +1444,34 @@ function feed_links_extra( $args ) {
|
||||||
|
|
||||||
if ( is_single() || is_page() ) {
|
if ( is_single() || is_page() ) {
|
||||||
$post = &get_post( $id = 0 );
|
$post = &get_post( $id = 0 );
|
||||||
if ( comments_open() || pings_open() || $post->comment_count > 0 )
|
|
||||||
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['singletitle'], get_bloginfo('name'), $args['seperator'], wp_specialchars( get_the_title() ) )) . '" href="' . get_post_comments_feed_link( $post->ID ) . "\" />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif ( is_category() ) {
|
if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
|
||||||
|
$title = attribute_escape(sprintf( $args['singletitle'], get_bloginfo('name'), $args['seperator'], wp_specialchars( get_the_title() ) ));
|
||||||
|
$href = get_post_comments_feed_link( $post->ID );
|
||||||
|
}
|
||||||
|
} elseif ( is_category() ) {
|
||||||
$cat_id = intval( get_query_var('cat') );
|
$cat_id = intval( get_query_var('cat') );
|
||||||
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['cattitle'], get_bloginfo('name'), $args['seperator'], get_cat_name( $cat_id ) )) . '" href="' . get_category_feed_link( $cat_id ) . "\" />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif ( is_tag() ) {
|
$title = attribute_escape(sprintf( $args['cattitle'], get_bloginfo('name'), $args['seperator'], get_cat_name( $cat_id ) ));
|
||||||
|
$href = get_category_feed_link( $cat_id );
|
||||||
|
} elseif ( is_tag() ) {
|
||||||
$tag_id = intval( get_query_var('tag_id') );
|
$tag_id = intval( get_query_var('tag_id') );
|
||||||
$tag = get_tag( $tag_id );
|
$tag = get_tag( $tag_id );
|
||||||
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['seperator'], $tag->name )) . '" href="' . get_tag_feed_link( $tag_id ) . "\" />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif ( is_author() ) {
|
$title = attribute_escape(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['seperator'], $tag->name ));
|
||||||
|
$href = get_tag_feed_link( $tag_id );
|
||||||
|
} elseif ( is_author() ) {
|
||||||
$author_id = intval( get_query_var('author') );
|
$author_id = intval( get_query_var('author') );
|
||||||
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['authortitle'], get_bloginfo('name'), $args['seperator'], get_author_name( $author_id ) )) . '" href="' . get_author_feed_link( $author_id ) . "\" />\n";
|
|
||||||
|
$title = attribute_escape(sprintf( $args['authortitle'], get_bloginfo('name'), $args['seperator'], get_author_name( $author_id ) ));
|
||||||
|
$href = get_author_feed_link( $author_id );
|
||||||
|
} elseif ( is_search() ) {
|
||||||
|
$title = attribute_escape(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['seperator'], get_search_query() ));
|
||||||
|
$href = get_search_feed_link();
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ( is_search() ) {
|
if ( isset($title) && isset($href) )
|
||||||
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['seperator'], get_search_query() )) . '" href="' . get_search_feed_link() . "\" />\n";
|
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . $title . '" href="' . $href . '" />' . "\n";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue