get_post_comments_feed_link example

/** * Fires at the end of each Atom feed item. * * @since 2.0.0 */
        do_action( 'atom_entry' );

        if ( get_comments_number() || comments_open() ) :
            ?> <link rel="replies" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php the_permalink_rss(); ?>#comments" thr:count="<?php echo get_comments_number(); ?>" /> <link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link( 0, 'atom' ) ); ?>" thr:count="<?php echo get_comments_number(); ?>" /> <thr:total><?php echo get_comments_number(); ?></thr:total> <?php endif; ?> </entry> <?php endwhile; ?> </feed>

        $show_post_comments_feed = apply_filters( 'feed_links_extra_show_post_comments_feed', $show_comments_feed );

        if ( $show_post_comments_feed && ( comments_open() || pings_open() || $post->comment_count > 0 ) ) {
            $title = sprintf(
                $args['singletitle'],
                get_bloginfo( 'name' ),
                $args['separator'],
                the_title_attribute( array( 'echo' => false ) )
            );

            $feed_link = get_post_comments_feed_link( $post->ID );

            if ( $feed_link ) {
                $href = $feed_link;
            }
        }
    } elseif ( is_post_type_archive() ) {
        /** * Filters whether to display the post type archive feed link. * * @since 6.1.0 * * @param bool $show Whether to display the post type archive feed link. Default true. */
/* translators: Comments feed title. %s: Site title. */
        printf( ent2ncr( __( 'Comments for %s' ) )get_wp_title_rss() );
    }
    ?> </title> <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle> <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated> <?php if ( is_singular() ) : ?> <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php comments_link_feed(); ?>" /> <link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link( '', 'atom' ) ); ?>" /> <id><?php echo esc_url( get_post_comments_feed_link( '', 'atom' ) ); ?></id> <?php elseif ( is_search() ) : ?> <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" /> <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link( '', 'atom' ); ?>" /> <id><?php echo get_search_comments_feed_link( '', 'atom' ); ?></id> <?php else : ?> <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" /> <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss( 'comments_atom_url' ); ?>" /> <id><?php bloginfo_rss( 'comments_atom_url' ); ?></id> <?php endif; ?> <?php

    $redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] );

    // It's not a preview, so remove it from URL.     if ( get_query_var( 'preview' ) ) {
        $redirect['query'] = remove_query_arg( 'preview', $redirect['query'] );
    }

    $post_id = get_query_var( 'p' );

    if ( is_feed() && $post_id ) {
        $redirect_url = get_post_comments_feed_link( $post_idget_query_var( 'feed' ) );
        $redirect_obj = get_post( $post_id );

        if ( $redirect_url ) {
            $redirect['query'] = _remove_qs_args_if_not_in_url(
                $redirect['query'],
                array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ),
                $redirect_url
            );

            $redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
        }
    }
<?php else : ?> <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> <?php $content = get_the_content_feed( 'rss2' ); ?> <?php if ( strlen( $content ) > 0 ) : ?> <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> <?php else : ?> <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded> <?php endif; ?> <?php endif; ?> <?php if ( get_comments_number() || comments_open() ) : ?> <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link( null, 'rss2' ) ); ?></wfw:commentRss> <slash:comments><?php echo get_comments_number(); ?></slash:comments> <?php endif; ?> <?php rss_enclosure(); ?> <?php         /** * Fires at the end of each RSS2 feed item. * * @since 2.0.0 */
        

function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
    $url = get_post_comments_feed_link( $post_id$feed );
    if ( empty( $link_text ) ) {
        $link_text = __( 'Comments Feed' );
    }

    $link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
    /** * Filters the post comment feed link anchor tag. * * @since 2.8.0 * * @param string $link The complete anchor tag for the comment feed link. * @param int $post_id Post ID. * @param string $feed The feed type. Possible values include 'rss2', 'atom', * or an empty string for the default feed type. */
/** * Return link to the post RSS feed. * * @since 1.5.0 * @deprecated 2.2.0 Use get_post_comments_feed_link() * @see get_post_comments_feed_link() * * @return string */
function comments_rss() {
    _deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' );
    return esc_url( get_post_comments_feed_link() );
}

/** * An alias of wp_create_user(). * * @since 2.0.0 * @deprecated 2.0.0 Use wp_create_user() * @see wp_create_user() * * @param string $username The user's username. * @param string $password The user's password. * @param string $email The user's email. * @return int The new user's ID. */
Home | Imprint | This part of the site doesn't use cookies.