Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_post_comments_feed_link [ WordPress Function ]

get_post_comments_feed_link ( $post_id = 0, $feed = '' )
Parameters:
  • (int) $post_id Optional. Post ID.
  • (string) $feed Optional. Feed type.
Returns:
  • (string)
Defined at:



Retrieve the permalink for the post comments feed.

Source


<?php
function get_post_comments_feed_link($post_id 0$feed '') {
    
$post_id absint$post_id );

    if ( ! 
$post_id )
        
$post_id get_the_ID();

    if ( empty( 
$feed ) )
        
$feed get_default_feed();

    if ( 
'' != get_option('permalink_structure') ) {
        if ( 
'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
            
$url _get_page_link$post_id );
        else
            
$url get_permalink($post_id);

        
$url trailingslashit($url) . 'feed';
        if ( 
$feed != get_default_feed() )
            
$url .= "/$feed";
        
$url user_trailingslashit($url'single_feed');
    } else {
        
$type get_post_field('post_type'$post_id);
        if ( 
'page' == $type )
            
$url home_url("?feed=$feed&amp;page_id=$post_id");
        else
            
$url home_url("?feed=$feed&amp;p=$post_id");
    }

    return 
apply_filters('post_comments_feed_link'$url);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics