本文整理汇总了PHP中get_post_comments_feed_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_comments_feed_link函数的具体用法?PHP get_post_comments_feed_link怎么用?PHP get_post_comments_feed_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_comments_feed_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evolve_discussion_rss
/**
* evolve_discussion_rss()
*
* @since 0.3
* @needsdoc
*/
function evolve_discussion_rss()
{
global $id;
$uri = get_post_comments_feed_link($id);
$text = "<span class=\"comment-feed-link\"><a title='" . __('Follow replies', 'evolve') . "' class=\"tipsytext follow-replies\" href=\"{$uri}\"><i class='fa fa-rss'></i></a></span>";
echo $text;
}
示例2: framework_discussion_rss
/**
* framework_discussion_rss()
*
* @since 0.3
* @needsdoc
*/
function framework_discussion_rss()
{
global $id;
$uri = get_post_comments_feed_link($id);
$text = "<p class=\"comment-feed-link\">You can follow all the replies to this entry through the <a href=\"{$uri}\">comments</a> feed.</p>";
echo $text;
}
示例3: test_unattached_pretty_link
public function test_unattached_pretty_link()
{
$this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
$attachment_id = $this->factory->attachment->create_object('image.jpg', 0, array('post_mime_type' => 'image/jpeg', 'post_type' => 'attachment'));
$link = get_post_comments_feed_link($attachment_id);
$expected = add_query_arg('attachment_id', $attachment_id, home_url('/feed/'));
$this->assertEquals($expected, $link);
}
示例4: postCommentsFeedLinkVariations
/**
* Post comments; feed link variations.
*
* @since 150422 Rewrite.
*
* @param \WP_Post A WordPress post class instance.
*
* @return array An array of all feed link variations.
*/
public function postCommentsFeedLinkVariations(\WP_Post $post)
{
$variations = [];
// Initialize.
foreach ($this->feed_types as $_feed_type) {
$variations[] = get_post_comments_feed_link($post->ID, $_feed_type);
}
unset($_feed_type);
// Housekeeping.
return $variations;
}
示例5: add_filter
</a></h1>
<?php
/* Don't remove these lines. */
add_filter('comment_text', 'popuplinks');
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<h2 id="comments"><?php
_e('Comments');
?>
</h2>
<p><a href="<?php
echo esc_url(get_post_comments_feed_link($post->ID));
?>
"><?php
_e('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.');
?>
</a></p>
<?php
if (pings_open()) {
?>
<p><?php
printf(__('The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em>%s</em>'), get_trackback_url());
?>
</p>
<?php
}
示例6: bloginfo_rss
<?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');
?>
示例7: wpi_comment_guide
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
</License>
</rdf:RDF>
-->
</li><?php
$cnt++;
}
/* end for each comment */
?>
<?php
wpi_comment_guide($post, $comments, $cnt);
?>
</ol>
<p class="mgt cb comments-feed"><a type="application/rss+xml" title="RSS 2.0 Comment Feed" href="<?php
echo rel(get_post_comments_feed_link());
?>
" rev="site:relative">RSS feed for comments in this post</a></p>
<?php
} else {
// displayed if there are no comments so far
?>
<?php
if ('open' == $post->comment_status) {
?>
<ol id="comments-list" class="commentlist r cf">
<?php
wpi_comment_guide($post, $comments, 1);
?>
示例8: post_comments_feed_link
/**
* Displays the comment feed link for a post.
*
* Prints out the comment feed link for a post. Link text is placed in the
* anchor. If no link text is specified, default text is used. If no post ID is
* specified, the current post is used.
*
* @since 2.5.0
*
* @param string $link_text Optional. Descriptive link text. Default 'Comments Feed'.
* @param int $post_id Optional. Post ID. Default is the ID of the global `$post`.
* @param string $feed Optional. Feed format. Default empty.
*/
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, or an empty string for the default feed type.
*/
echo apply_filters('post_comments_feed_link_html', $link, $post_id, $feed);
}
示例9: get_option
?>
);
body { margin: 3px; }
</style>
</head>
<body id="commentspopup">
<h1 id="header"><a href="" title="<?php
echo get_option('blogname');
?>
"><?php
echo get_option('blogname');
?>
</a></h1>
<h2 id="comments">Comments</h2>
<p><a href="<?php
echo get_post_comments_feed_link($post->ID);
?>
"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>
<?php
if ('open' == $post->ping_status) {
?>
<p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php
trackback_url();
?>
</em></p>
<?php
}
?>
<?php
// this line is WordPress' motor, do not delete it.
$commenter = wp_get_current_commenter();
示例10: flush_post
//.........这里部分代码省略.........
if ($this->_config->get_boolean('pgcache.purge.archive.monthly') && $post) {
$post_date = strtotime($post->post_date);
$post_year = gmdate('Y', $post_date);
$post_month = gmdate('m', $post_date);
$posts_per_page = get_option('posts_per_page');
$posts_number = $this->_get_archive_posts_count($post_year, $post_month);
$posts_pages_number = @ceil($posts_number / $posts_per_page);
$month_link = get_month_link($post_year, $post_month);
$month_uri = str_replace($domain_url, '', $month_link);
for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
$month_pagenum_link = $this->_get_pagenum_link($month_uri, $pagenum);
$month_pagenum_uri = str_replace($domain_url, '', $month_pagenum_link);
$uris[] = $month_pagenum_uri;
}
}
/**
* Yearly archive URLs
*/
if ($this->_config->get_boolean('pgcache.purge.archive.yearly') && $post) {
$post_date = strtotime($post->post_date);
$post_year = gmdate('Y', $post_date);
$posts_per_page = get_option('posts_per_page');
$posts_number = $this->_get_archive_posts_count($post_year);
$posts_pages_number = @ceil($posts_number / $posts_per_page);
$year_link = get_year_link($post_year);
$year_uri = str_replace($domain_url, '', $year_link);
for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
$year_pagenum_link = $this->_get_pagenum_link($year_uri, $pagenum);
$year_pagenum_uri = str_replace($domain_url, '', $year_pagenum_link);
$uris[] = $year_pagenum_uri;
}
}
/**
* Feed URLs
*/
if ($this->_config->get_boolean('pgcache.purge.feed.blog')) {
foreach ($feeds as $feed) {
$feed_link = get_feed_link($feed);
$feed_uri = str_replace($domain_url, '', $feed_link);
$uris[] = $feed_uri;
}
}
if ($this->_config->get_boolean('pgcache.purge.feed.comments')) {
foreach ($feeds as $feed) {
$post_comments_feed_link = get_post_comments_feed_link($post_id, $feed);
$post_comments_feed_uri = str_replace($domain_url, '', $post_comments_feed_link);
$uris[] = $post_comments_feed_uri;
}
}
if ($this->_config->get_boolean('pgcache.purge.feed.author') && $post) {
foreach ($feeds as $feed) {
$author_feed_link = get_author_feed_link($post->post_author, $feed);
$author_feed_uri = str_replace($domain_url, '', $author_feed_link);
$uris[] = $author_feed_uri;
}
}
if ($this->_config->get_boolean('pgcache.purge.feed.terms')) {
foreach ($terms as $term) {
foreach ($feeds as $feed) {
$term_feed_link = get_term_feed_link($term->term_id, $term->taxonomy, $feed);
$term_feed_uri = str_replace($domain_url, '', $term_feed_link);
$uris[] = $term_feed_uri;
}
}
}
/**
* Flush cache
*/
if (count($uris)) {
$cache =& $this->_get_cache();
$mobile_groups = $this->_get_mobile_groups();
$referrer_groups = $this->_get_referrer_groups();
$encryptions = $this->_get_encryptions();
$compressions = $this->_get_compressions();
foreach ($uris as $uri) {
foreach ($mobile_groups as $mobile_group) {
foreach ($referrer_groups as $referrer_group) {
foreach ($encryptions as $encryption) {
foreach ($compressions as $compression) {
$page_key = $this->_get_page_key($uri, $mobile_group, $referrer_group, $encryption, $compression);
$cache->delete($page_key);
}
}
}
}
}
/**
* Purge varnish servers
*/
if ($this->_config->get_boolean('varnish.enabled')) {
$varnish =& w3_instance('W3_Varnish');
foreach ($uris as $uri) {
$varnish->purge($uri);
}
}
}
return true;
}
return false;
}
示例11: bloginfo_rss
<?php
if (is_singular()) {
?>
<link rel="alternate" type="<?php
bloginfo_rss('html_type');
?>
" href="<?php
echo get_comments_link();
?>
" />
<link rel="self" type="application/atom+xml" href="<?php
echo get_post_comments_feed_link('', 'atom');
?>
" />
<id><?php
echo get_post_comments_feed_link('', 'atom');
?>
</id>
<?php
} elseif (is_search()) {
?>
<link rel="alternate" type="<?php
bloginfo_rss('html_type');
?>
" href="<?php
echo get_option('home') . '?s=' . attribute_escape(get_search_query());
?>
" />
<link rel="self" type="application/atom+xml" href="<?php
echo get_search_comments_feed_link('', 'atom');
?>
示例12: redirect_guess_404_permalink
/**
* Attempts to guess the correct URL from the current URL (that produced a 404) or
* the current query variables.
*
* @since 2.3.0
* @uses $wpdb
*
* @param string $current_url Optional. The URL that has 404'd.
* @return bool|string The correct URL if one is found. False on failure.
*/
function redirect_guess_404_permalink( $current_url = '' ) {
global $wpdb, $wp_rewrite;
if ( ! empty( $current_url ) )
$parsed_url = @parse_url( $current_url );
// Attempt to redirect bare category slugs if the permalink structure starts
// with the %category% tag.
if ( isset( $parsed_url['path'] )
&& preg_match( '#^[^%]+%category%#', $wp_rewrite->permalink_structure )
&& $cat = get_category_by_path( $parsed_url['path'] )
) {
if ( ! is_wp_error( $cat ) )
return get_term_link( $cat );
}
if ( get_query_var('name') ) {
$where = $wpdb->prepare("post_name LIKE %s", like_escape( get_query_var('name') ) . '%');
// if any of post_type, year, monthnum, or day are set, use them to refine the query
if ( get_query_var('post_type') )
$where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type'));
else
$where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
if ( get_query_var('year') )
$where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year'));
if ( get_query_var('monthnum') )
$where .= $wpdb->prepare(" AND MONTH(post_date) = %d", get_query_var('monthnum'));
if ( get_query_var('day') )
$where .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", get_query_var('day'));
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'");
if ( ! $post_id )
return false;
if ( get_query_var( 'feed' ) )
return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) );
elseif ( get_query_var( 'page' ) )
return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
else
return get_permalink( $post_id );
}
return false;
}
示例13: get_option
<title><?php echo get_option('blogname'); ?> - <?php echo sprintf(__("Comments on %s"), the_title('','',false)); ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<style type="text/css" media="screen">
@import url( <?php bloginfo('stylesheet_url'); ?> );
body { margin: 3px; }
</style>
</head>
<body id="commentspopup">
<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
<h2 id="comments"><?php _e("Comments"); ?></h2>
<p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p>
<?php if ('open' == $post->ping_status) { ?>
<p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
<?php } ?>
<?php
// this line is WordPress' motor, do not delete it.
$commenter = wp_get_current_commenter();
extract($commenter);
$comments = get_approved_comments($id);
$commentstatus = get_post($id);
if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $commentstatus->post_password) { // and it doesn't match the cookie
echo(get_the_password_form());
} else { ?>
示例14: getAttachment
public function getAttachment()
{
global $wp_query;
$title = string_len(trim(wp_title('', false)), 90);
$pid = $wp_query->post->ID;
$ppid = $wp_query->post->post_parent;
$pathway = array();
// rss
$pathway['first'] = array($title . ' comments feeds', array('href' => get_post_comments_feed_link($pid), 'type' => 'application/rss+xml', 'title' => __($title . ' | Subscribe to this comments feed', WPI_META), 'hreflang' => get_hreflang(), 'rel' => self::RSS_REL, 'class' => 'rtxt rss16', 'rev' => 'feed:rss2'));
// home
$pathway['home'] = $this->getFrontpage();
// parent
$att = array();
$att['href'] = get_permalink($ppid);
$att['title'] = 'Parent | ' . get_the_title($ppid);
$att['class'] = 'parent-link dc-subject';
$att['hreflang'] = get_hreflang();
$pathway['parent'] = array(get_the_title($ppid), $att);
// attachments
$att = array();
$att['href'] = get_permalink($pid);
$att['title'] = __('Attachment | permalink', WPI_META);
$pathway['attachment'] = array('Attachment', $att);
// attachments-pid
$att = array();
$att['href'] = get_permalink() . '#content-top';
$att['title'] = $title . ' | Skip to content';
$att['hreflang'] = get_hreflang();
$att['class'] = 'last-items ' . self::DN_ARROW;
if (($pageno = wpi_get_post_current_paged()) != false) {
$pathway['post'] = array($title, $att);
$title = 'on page ' . $pageno;
$att = array();
$att['href'] = wpi_paged_url($pageno);
$att['title'] = $title;
$att['rev'] = 'site:relative';
}
$pathway['last'] = array($title, $att);
return $pathway;
}
示例15: test_entry_elements
/**
* Validate <entry> child elements.
*/
function test_entry_elements()
{
$this->go_to('/?feed=atom');
$feed = $this->do_atom();
$xml = xml_to_array($feed);
// Get all the <entry> child elements of the <feed> element.
$entries = xml_find($xml, 'feed', 'entry');
// Verify we are displaying the correct number of posts.
$this->assertCount($this->post_count, $entries);
// We Really only need to test X number of entries unless the content is different
$entries = array_slice($entries, 1);
// Check each of the desired entries against the known post data.
foreach ($entries as $key => $entry) {
// Get post for comparison
$id = xml_find($entries[$key]['child'], 'id');
preg_match('/\\?p=(\\d+)/', $id[0]['content'], $matches);
$post = get_post($matches[1]);
// Author
$author = xml_find($entries[$key]['child'], 'author', 'name');
$user = new WP_User($post->post_author);
$this->assertEquals($user->display_name, $author[0]['content']);
// Title
$title = xml_find($entries[$key]['child'], 'title');
$this->assertEquals($post->post_title, $title[0]['content']);
// Link rel="alternate"
$link_alts = xml_find($entries[$key]['child'], 'link');
foreach ($link_alts as $link_alt) {
if ('alternate' == $link_alt['attributes']['rel']) {
$this->assertEquals(get_permalink($post), $link_alt['attributes']['href']);
}
}
// Id
$guid = xml_find($entries[$key]['child'], 'id');
$this->assertEquals($post->guid, $id[0]['content']);
// Updated
$updated = xml_find($entries[$key]['child'], 'updated');
$this->assertEquals(strtotime($post->post_modified_gmt), strtotime($updated[0]['content']));
// Published
$published = xml_find($entries[$key]['child'], 'published');
$this->assertEquals(strtotime($post->post_date_gmt), strtotime($published[0]['content']));
// Category
foreach (get_the_category($post->ID) as $term) {
$terms[] = $term->name;
}
$categories = xml_find($entries[$key]['child'], 'category');
foreach ($categories as $category) {
$this->assertTrue(in_array($category['attributes']['term'], $terms));
}
unset($terms);
// Content
if (!$this->excerpt_only) {
$content = xml_find($entries[$key]['child'], 'content');
$this->assertEquals(trim(apply_filters('the_content', $post->post_content)), trim($content[0]['content']));
}
// Link rel="replies"
$link_replies = xml_find($entries[$key]['child'], 'link');
foreach ($link_replies as $link_reply) {
if ('replies' == $link_reply['attributes']['rel'] && 'application/atom+xml' == $link_reply['attributes']['type']) {
$this->assertEquals(get_post_comments_feed_link($post->ID, 'atom'), $link_reply['attributes']['href']);
}
}
}
}