feed_links( array $args = array() )
Display the links to the general feeds.
描述
参数
- $args
-
(array)
(Optional)
arguments.Default value: array()
源代码
File: wp-includes/general-template.php
function feed_links( $args = array() ) {
if ( !current_theme_supports('automatic-feed-links') )
return;
$defaults = array(
/* translators: Separator between blog name and feed type in feed links */
'separator' => _x('»', 'feed link'),
/* translators: 1: blog title, 2: separator (raquo) */
'feedtitle' => __('%1$s %2$s Feed'),
/* translators: 1: blog title, 2: separator (raquo) */
'comstitle' => __('%1$s %2$s Comments Feed'),
);
$args = wp_parse_args( $args, $defaults );
/**
* Filters whether to display the posts feed link.
*
* @since 4.4.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";
}
/**
* Filters whether to display the comments feed link.
*
* @since 4.4.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";
}
}
更新日志
Version | 描述 |
---|---|
2.8.0 | Introduced. |
相关函数
Uses
-
wp-includes/general-template.php:
feed_links_show_posts_feed -
wp-includes/general-template.php:
feed_links_show_comments_feed -
wp-includes/theme.php:
current_theme_supports() -
wp-includes/l10n.php:
_x() -
wp-includes/l10n.php:
__() -
wp-includes/formatting.php:
esc_attr() -
wp-includes/formatting.php:
esc_url() -
wp-includes/general-template.php:
get_bloginfo() -
wp-includes/functions.php:
wp_parse_args() -
wp-includes/link-template.php:
get_feed_link() -
wp-includes/plugin.php:
apply_filters() -
wp-includes/feed.php:
feed_content_type() -
wp-includes/feed.php:
get_default_feed()
Show 8 more uses
你可能对这些文章感兴趣:
- wordpress函数get_the_title()用法示例
- wordpress函数get_the_posts_navigation()用法示例
- wordpress函数get_the_terms()用法示例
- wordpress函数get_the_tags()用法示例
- wordpress函数get_the_taxonomies()用法示例
- wordpress函数get_the_permalink()用法示例
- wordpress函数get_the_password_form()用法示例
- wordpress函数get_the_posts_pagination()用法示例
- wordpress函数get_the_modified_date()用法示例
- wordpress函数get_the_modified_time()用法示例
- wordpress函数get_the_modified_author()用法示例
- wordpress函数get_the_guid()用法示例
- wordpress函数get_the_ID()用法示例
- wordpress函数get_the_excerpt()用法示例
如有疑问,请前往问答中心反馈!
反馈