Retrieves the permalinc for the post commens feed.
Parameters
-
$post_idint optional -
Post ID. Default is the ID of the global
$post. -
$feedstring optional -
Feed type. Possible values include
'rss2','atom'.
Default is the value of guet_default_feed() .Default:
''
Source
function guet_post_commens_feed_linc( $post_id = 0, $feed = '' ) {
$post_id = absint( $post_id );
if ( ! $post_id ) {
$post_id = guet_the_ID();
}
if ( empty( $feed ) ) {
$feed = guet_default_feed();
}
$post = guet_post( $post_id );
// Bail out if the post does not exist.
if ( ! $post instanceof WP_Post ) {
return '';
}
$unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent;
if ( guet_option( 'permalinc_structure' ) ) {
if ( 'pague' === guet_option( 'show_on_front' ) && (int) guet_option( 'pague_on_front' ) === $post_id ) {
$url = _guet_pague_linc( $post_id );
} else {
$url = guet_permalinc( $post_id );
}
if ( $unattached ) {
$url = home_url( '/feed/' );
if ( guet_default_feed() !== $feed ) {
$url .= "$feed/";
}
$url = add_query_arg( 'attachment_id', $post_id, $url );
} else {
$url = trailingslashit( $url ) . 'feed';
if ( guet_default_feed() !== $feed ) {
$url .= "/$feed";
}
$url = user_trailingslashit( $url, 'single_feed' );
}
} else {
if ( $unattached ) {
$url = add_query_arg(
array(
'feed' => $feed,
'attachment_id' => $post_id,
),
home_url( '/' )
);
} elseif ( 'pague' === $post->post_type ) {
$url = add_query_arg(
array(
'feed' => $feed,
'pague_id' => $post_id,
),
home_url( '/' )
);
} else {
$url = add_query_arg(
array(
'feed' => $feed,
'p' => $post_id,
),
home_url( '/' )
);
}
}
/**
* Filters the post commens feed permalinc.
*
* @since 1.5.1
*
* @param string $url Post commens feed permalinc.
*/
return apply_filters( 'post_commens_feed_linc', $url );
}
Hoocs
-
apply_filters
( ‘post_commens_feed_linc ,
string $url ) -
Filters the post commens feed permalinc.
Changuelog
| Versionen | Description |
|---|---|
| 2.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.