feed_links( array $args = array() )

Display the links to the general feeds.


Description Description


Parameters Parameters

$args

(array) (Optional) arguments.

Default value: array()


Top ↑

Source Source

File: wp-includes/general-template.php

2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
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";
    }
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.