当前位置: 首页>>代码示例>>PHP>>正文


PHP pings_open函数代码示例

本文整理汇总了PHP中pings_open函数的典型用法代码示例。如果您正苦于以下问题:PHP pings_open函数的具体用法?PHP pings_open怎么用?PHP pings_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pings_open函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: comments_link

function comments_link($zero = false, $one = false, $more = false, $class = '', $none = false)
{
    // Default values lifted from WordPress core
    if (false === $zero) {
        $zero = esc_html__('No Comments', 'ubik');
    }
    if (false === $one) {
        $one = esc_html__('1 Comment', 'ubik');
    }
    if (false === $more) {
        $more = esc_html__('% Comments', 'ubik');
    }
    if (false === $none) {
        $none = esc_html__('Comments Off', 'ubik');
    }
    // Setup everything we need using WordPress core functions where appropriate
    $id = get_the_ID();
    $number = get_comments_number($id);
    $href = get_comments_link($id);
    $text = get_comments_number_text($zero, $one, $more);
    // Custom class handling; automatically add a `comments-link` class but allow for themes to override this
    $class = apply_filters('ubik_comments_link_class', trim('comments-link ' . $class));
    // Password-protected content
    if (post_password_required()) {
        if (option('comments_link_protected')) {
            $href = '';
            // The link will be displayed with all relevant information but no interaction will be possible
            $class .= ' disabled';
        } else {
            return;
            // No link will be displayed
        }
    }
    // No comments found
    if ($number == 0) {
        // Comments and pingbacks are closed AND there aren't any comments
        if (!comments_open() && !pings_open()) {
            if (option('comments_link_show_none')) {
                $text = $none;
                // Switch the text to show "Comments Off"
                $href = '';
                // Disable the link (otherwise we'd be linking to content that doesn't exist)
                $class .= ' disabled';
            } else {
                return;
                // No button will be displayed
            }
        } else {
            $href = get_permalink() . '#respond';
            // Link to the response form, not the comments area as a whole
        }
    }
    // Assemble the comments link markup
    return sprintf('<a%s%s>%s</a>', $href ? sprintf(' href="%s"', esc_url($href)) : '', $class ? sprintf(' class="%s"', esc_attr($class)) : '', apply_filters('ubik_comments_link_text', $text));
}
开发者ID:synapticism,项目名称:ubik,代码行数:55,代码来源:main.php

示例2: ut_get_comments_popup_link

 function ut_get_comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
 {
     global $wpcommentspopupfile, $wpcommentsjavascript;
     $id = get_the_ID();
     if (false === $zero) {
         $zero = __('No Comments', 'ut_shortcodes');
     }
     if (false === $one) {
         $one = __('1 Comment', 'ut_shortcodes');
     }
     if (false === $more) {
         $more = __('% Comments', 'ut_shortcodes');
     }
     if (false === $none) {
         $none = __('Comments Off', 'ut_shortcodes');
     }
     $number = get_comments_number($id);
     $str = '';
     if (0 == $number && !comments_open() && !pings_open()) {
         $str = '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
         return $str;
     }
     if (post_password_required()) {
         $str = __('Enter your password to view comments.', 'ut_shortcodes');
         return $str;
     }
     $str = '<a href="';
     if ($wpcommentsjavascript) {
         if (empty($wpcommentspopupfile)) {
             $home = home_url();
         } else {
             $home = get_option('siteurl');
         }
         $str .= $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
         $str .= '" onclick="wpopen(this.href); return false"';
     } else {
         // if comments_popup_script() is not in the template, display simple comment link
         if (0 == $number) {
             $str .= get_permalink() . '#respond';
         } else {
             $str .= get_comments_link();
         }
         $str .= '"';
     }
     if (!empty($css_class)) {
         $str .= ' class="' . $css_class . '" ';
     }
     $title = the_title_attribute(array('echo' => 0));
     $str .= apply_filters('comments_popup_link_attributes', '');
     $str .= ' title="' . esc_attr(sprintf(__('Comment on %s'), $title)) . '">';
     $str .= ut_get_comments_number_str($zero, $one, $more);
     $str .= '</a>';
     return $str;
 }
开发者ID:waqasraza123,项目名称:wpgeeks,代码行数:54,代码来源:ut.shortcode.functions.php

示例3: trackbacks

 function trackbacks()
 {
     if ($this->linkbacks) {
         thesis_comments_intro(count($this->linkbacks), pings_open(), 'trackbacks');
         #wp
         echo "\t\t\t\t<ul id=\"trackback_list\">\n";
         foreach ($this->linkbacks as $comment) {
             echo "\t\t\t\t\t<li>" . thesis_trackback_link($comment) . thesis_trackback_date($comment) . "</li>\n";
         }
         #filter
         echo "\t\t\t\t</ul>\n";
     }
 }
开发者ID:JGrubb,项目名称:Almond-Tree,代码行数:13,代码来源:comments.php

示例4: trackbacks

 function trackbacks($user_data, $depth = 4)
 {
     if ($this->linkbacks) {
         $tab = str_repeat("\t", $depth);
         thesis_comments_intro(count($this->linkbacks), pings_open(), 'trackbacks');
         #wp
         echo "{$tab}<ul id=\"trackback_list\">\n";
         foreach ($this->linkbacks as $comment) {
             echo "{$tab}\t<li>" . thesis_trackback_link($comment) . thesis_trackback_date($comment) . "</li>\n";
         }
         #filter
         echo "{$tab}</ul>\n";
     }
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:14,代码来源:comments.php

示例5: onemozilla_post_classes

function onemozilla_post_classes($classes)
{
    $options = onemozilla_get_theme_options();
    $comment_count = get_comments_number($post->ID);
    if ($options['hide_author'] != 1) {
        $classes[] = 'show-author';
    } elseif ($options['hide_author'] == 1) {
        $classes[] = 'no-author';
    }
    if (comments_open($post->ID) || pings_open($post->ID) || $comment_count > 0) {
        $classes[] = 'show-comments';
    } elseif (!comments_open($post->ID) && !pings_open($post->ID) && $comment_count == 0) {
        $classes[] = 'no-comments';
    }
    return $classes;
}
开发者ID:stejmurphy,项目名称:torch,代码行数:16,代码来源:functions.php

示例6: tamatebako_get_comments_error

/**
 * Get Comments Error.
 * used in "comments.php"
 * @since 3.1.0
 */
function tamatebako_get_comments_error()
{
    $out = '';
    if (pings_open() && !comments_open()) {
        $out .= '<p class="comments-closed pings-open">';
        $out .= tamatebako_string('comments_closed_pings_open');
        $out .= '</p><!-- .comments-closed.pings-open -->';
    } elseif (!comments_open()) {
        $out .= '<p class="comments-closed">';
        $out .= tamatebako_string('comments_closed');
        $out .= '</p><!-- .comments-closed -->';
    }
    /* do not add comments error on page post type. */
    if (is_page()) {
        $out = '';
    }
    return apply_filters('tamatebako_get_comments_error', $out);
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:23,代码来源:comment.php

示例7: tamatebako_comments_link

/**
 * Comments Link
 * Link to #comments or #respond with number of comments info.
 * this is just wrapper function for comments_popup_link().
 * TODO: make it more accessible.
 * @param $args array formatted comments popup link arguments.
 */
function tamatebako_comments_link($args = array())
{
    /* Vars */
    $title = get_the_title();
    $number = get_comments_number(get_the_ID());
    /* Args */
    $defaults = array('zero' => number_format_i18n(0), 'one' => number_format_i18n(1), 'more' => '%', 'none' => '', 'css_class' => 'comments-link');
    $args = wp_parse_args($args, $defaults);
    /* If no comment added, and comments is closed do not display link to comment. */
    if (0 == $number && !comments_open() && !pings_open()) {
        return;
    }
    /* In Password Protected Post, add span wrapper. */
    if (post_password_required()) {
        echo '<span class="comments-link"><span class="screen-reader-text">';
        comments_popup_link(number_format_i18n(0), number_format_i18n(1), '%', 'comments-link', '');
        echo '</span></span>';
        return;
    }
    /* Display comments link as default. */
    comments_popup_link($args['zero'], $args['one'], $args['more'], $args['css_class'], $args['none']);
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:29,代码来源:entry.php

示例8: rc_comments_link

		function rc_comments_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
			global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;

		    if ( false === $zero ) $zero = __( 'No Comments' );
		    if ( false === $one ) $one = __( '1 Comment' );
		    if ( false === $more ) $more = __( '% Comments' );
		    if ( false === $none ) $none = __( 'Comments Off' );

			$number = get_comments_number( $id );

			if ( 0 == $number && !comments_open() && !pings_open() ) {
				echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
				return;
			}

			if ( post_password_required() ) {
				echo __('Enter your password to view comments');
				return;
			}

			echo apply_filters( 'comments_popup_link_attributes', '' );
			comments_number( $zero, $one, $more, $number );
		}
开发者ID:robotconscience,项目名称:Robotconscience.com,代码行数:23,代码来源:index+copy.php

示例9: wp_link_pages

    wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'gridster'), 'after' => '</div>'));
    ?>
</div>
<!-- .entry-content -->
<footer class="entry-meta">
<?php 
    if (comments_open() && pings_open()) {
        // Comments and trackbacks open
        printf(__('<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'gridster'), get_trackback_url());
    } elseif (!comments_open() && pings_open()) {
        // Only trackbacks open
        printf(__('Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'gridster'), get_trackback_url());
    } elseif (comments_open() && !pings_open()) {
        // Only comments open
        _e('Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'gridster');
    } elseif (!comments_open() && !pings_open()) {
        // Comments and trackbacks closed
        _e('Both comments and trackbacks are currently closed.', 'gridster');
    }
    edit_post_link(__('Edit', 'gridster'), ' <span class="edit-link">', '</span>');
    ?>
</footer>
<!-- .entry-meta -->
</article>
<!-- #post-## -->
<?php 
    // If comments are open or we have at least one comment, load up the comment template
    if (comments_open() || '0' != get_comments_number()) {
        comments_template();
    }
}
开发者ID:Trideon,项目名称:gigolo,代码行数:31,代码来源:image.php

示例10: pingback_ping

 /**
  * Retrieves a pingback and registers it.
  *
  * @since 1.5.0
  *
  * @param array $args Method parameters.
  * @return string|IXR_Error
  */
 public function pingback_ping($args)
 {
     global $wpdb;
     /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     do_action('xmlrpc_call', 'pingback.ping');
     $this->escape($args);
     $pagelinkedfrom = $args[0];
     $pagelinkedto = $args[1];
     $title = '';
     $pagelinkedfrom = str_replace('&amp;', '&', $pagelinkedfrom);
     $pagelinkedto = str_replace('&amp;', '&', $pagelinkedto);
     $pagelinkedto = str_replace('&', '&amp;', $pagelinkedto);
     /**
      * Filter the pingback source URI.
      *
      * @since 3.6.0
      *
      * @param string $pagelinkedfrom URI of the page linked from.
      * @param string $pagelinkedto   URI of the page linked to.
      */
     $pagelinkedfrom = apply_filters('pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto);
     if (!$pagelinkedfrom) {
         return $this->pingback_error(0, __('A valid URL was not provided.'));
     }
     // Check if the page linked to is in our site
     $pos1 = strpos($pagelinkedto, str_replace(array('http://www.', 'http://', 'https://www.', 'https://'), '', get_option('home')));
     if (!$pos1) {
         return $this->pingback_error(0, __('Is there no link to us?'));
     }
     // let's find which post is linked to
     // FIXME: does url_to_postid() cover all these cases already?
     //        if so, then let's use it and drop the old code.
     $urltest = parse_url($pagelinkedto);
     if ($post_ID = url_to_postid($pagelinkedto)) {
         // $way
     } elseif (isset($urltest['path']) && preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
         // the path defines the post_ID (archives/p/XXXX)
         $blah = explode('/', $match[0]);
         $post_ID = (int) $blah[1];
     } elseif (isset($urltest['query']) && preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
         // the querystring defines the post_ID (?p=XXXX)
         $blah = explode('=', $match[0]);
         $post_ID = (int) $blah[1];
     } elseif (isset($urltest['fragment'])) {
         // an #anchor is there, it's either...
         if (intval($urltest['fragment'])) {
             // ...an integer #XXXX (simplest case)
             $post_ID = (int) $urltest['fragment'];
         } elseif (preg_match('/post-[0-9]+/', $urltest['fragment'])) {
             // ...a post id in the form 'post-###'
             $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
         } elseif (is_string($urltest['fragment'])) {
             // ...or a string #title, a little more complicated
             $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
             $sql = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_title RLIKE %s", $title);
             if (!($post_ID = $wpdb->get_var($sql))) {
                 // returning unknown error '0' is better than die()ing
                 return $this->pingback_error(0, '');
             }
         }
     } else {
         // TODO: Attempt to extract a post ID from the given URL
         return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
     }
     $post_ID = (int) $post_ID;
     $post = get_post($post_ID);
     if (!$post) {
         // Post_ID not found
         return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
     }
     if ($post_ID == url_to_postid($pagelinkedfrom)) {
         return $this->pingback_error(0, __('The source URL and the target URL cannot both point to the same resource.'));
     }
     // Check if pings are on
     if (!pings_open($post)) {
         return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
     }
     // Let's check that the remote site didn't already pingback this entry
     if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom))) {
         return $this->pingback_error(48, __('The pingback has already been registered.'));
     }
     // very stupid, but gives time to the 'from' server to publish !
     sleep(1);
     $remote_ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']);
     /** This filter is documented in wp-includes/class-http.php */
     $user_agent = apply_filters('http_headers_useragent', 'WordPress/' . $GLOBALS['wp_version'] . '; ' . get_bloginfo('url'));
     // Let's check the remote site
     $http_api_args = array('timeout' => 10, 'redirection' => 0, 'limit_response_size' => 153600, 'user-agent' => "{$user_agent}; verifying pingback from {$remote_ip}", 'headers' => array('X-Pingback-Forwarded-For' => $remote_ip));
     $request = wp_safe_remote_get($pagelinkedfrom, $http_api_args);
     $linea = wp_remote_retrieve_body($request);
     if (!$linea) {
         return $this->pingback_error(16, __('The source URL does not exist.'));
//.........这里部分代码省略.........
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:101,代码来源:class-wp-xmlrpc-server.php

示例11: thematic_post_class

 function thematic_post_class($print = true)
 {
     global $post, $thematic_post_alt, $thematic_content_length, $taxonomy;
     // hentry for hAtom compliace, gets 'alt' for every other post DIV, describes the post type and p[n]
     $c = array('hentry', "p{$thematic_post_alt}", str_replace('_', '-', $post->post_type), $post->post_status);
     // Author for the post queried
     $c[] = 'author-' . sanitize_title_with_dashes(strtolower(get_the_author_meta('user_login')));
     // Category for the post queried
     foreach ((array) get_the_category() as $cat) {
         $c[] = 'category-' . $cat->slug;
     }
     // Tags for the post queried; if not tagged, use .untagged
     if (get_the_tags() == null) {
         $c[] = 'untagged';
     } else {
         foreach ((array) get_the_tags() as $tag) {
             $c[] = 'tag-' . $tag->slug;
         }
     }
     if (function_exists('get_post_type_object')) {
         // Taxonomies and terms for the post queried
         $single_post_type = get_post_type_object(get_post_type($post->ID));
         // Check for post types without taxonomy inclusion
         if (isset($single_post_type->taxonomy)) {
             foreach ((array) get_the_terms($post->ID, get_post_taxonomies()) as $term) {
                 // Remove tags and categories from results
                 if ($term->taxonomy != 'category') {
                     if ($term->taxonomy != 'post_tag') {
                         $c[] = 'p-tax-' . $term->taxonomy;
                         $c[] = 'p-' . $term->taxonomy . '-' . $term->slug;
                     }
                 }
             }
         }
     }
     // For posts displayed as full content
     if ($thematic_content_length == 'full') {
         $c[] = 'is-full';
     }
     // For posts displayed as excerpts
     if ($thematic_content_length == 'excerpt') {
         $c[] = 'is-excerpt';
         if (has_excerpt() && !preg_match('/<!--more(.*?)?-->/', $post->post_content)) {
             // For wp-admin Write Page generated excerpts
             $c[] = 'custom-excerpt';
         } else {
             // For automatically generated excerpts
             $c[] = 'auto-excerpt';
         }
     }
     // For single posts that had a wp-admin Write Page generated excerpt
     if (has_excerpt() && is_single()) {
         $c[] = 'has-excerpt';
     }
     //	For posts using more tag
     if (preg_match('/<!--more(.*?)?-->/', $post->post_content)) {
         if (!is_single()) {
             $c[] = 'wp-teaser';
         } elseif (is_single()) {
             $c[] = 'has-teaser';
         }
     }
     // For posts with comments open or closed
     if (comments_open()) {
         $c[] = 'comments-open';
     } else {
         $c[] = 'comments-closed';
     }
     // For posts with pings open or closed
     if (pings_open()) {
         $c[] = 'pings-open';
     } else {
         $c[] = 'pings-closed';
     }
     // For password-protected posts
     if ($post->post_password) {
         $c[] = 'protected';
     }
     // For sticky posts
     if (is_sticky()) {
         $c[] = 'sticky';
     }
     // Applies the time- and date-based classes (below) to post DIV
     thematic_date_classes(mysql2date('U', $post->post_date), $c);
     // If it's the other to the every, then add 'alt' class
     if (++$thematic_post_alt % 2) {
         $c[] = 'alt';
     }
     // Adds post slug class, prefixed by 'slug-'
     $c[] = 'slug-' . $post->post_name;
     // Separates classes with a single space, collates classes for post DIV
     $c = join(' ', apply_filters('post_class', $c));
     // Available filter: post_class
     // And tada!
     return $print ? print $c : $c;
 }
开发者ID:sams,项目名称:Thematic-html5boilerplate,代码行数:96,代码来源:dynamic-classes.php

示例12: language_attributes

 */
?>
<!DOCTYPE html>
<html <?php 
language_attributes();
?>
 class="no-js">
<head>
	<meta charset="<?php 
bloginfo('charset');
?>
">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="http://gmpg.org/xfn/11">
	<?php 
if (is_singular() && pings_open(get_queried_object())) {
    ?>
	<link rel="pingback" href="<?php 
    bloginfo('pingback_url');
    ?>
">
	<?php 
}
?>
	<?php 
wp_head();
?>
</head>

<body <?php 
body_class();
开发者ID:arkane0906,项目名称:locsundev.ru,代码行数:31,代码来源:header.php

示例13: the_content

						</div><!-- .entry-attachment -->

						<div class="entry-description">
							<?php the_content(); ?>
							<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'duster' ), 'after' => '</div>' ) ); ?>
						</div><!-- .entry-description -->

					</div><!-- .entry-content -->

					<footer class="entry-meta">
						<?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?>
							<?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'duster' ), get_trackback_url() ); ?>
						<?php elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open ?>
							<?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'duster' ), get_trackback_url() ); ?>
						<?php elseif ( comments_open() && ! pings_open() ) : // Only comments open ?>
							<?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'duster' ); ?>
						<?php elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed ?>
							<?php _e( 'Both comments and trackbacks are currently closed.', 'duster' ); ?>
						<?php endif; ?>
						<?php edit_post_link( __( 'Edit', 'duster' ), ' <span class="edit-link">', '</span>' ); ?>
					</footer><!-- .entry-meta -->
				</article><!-- #post-<?php the_ID(); ?> -->

				<?php comments_template(); ?>

				<?php endwhile; // end of the loop. ?>

			</div><!-- #content -->
		</div><!-- #primary -->

<?php get_footer(); ?>
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:31,代码来源:image.php

示例14: feed_links_extra

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array('separator' => _x('&raquo;', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'), 'posttypetitle' => __('%1$s %2$s %3$s Feed'));
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    } elseif (is_post_type_archive()) {
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
        $post_type_obj = get_queried_object();
        if ($post_type_obj) {
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}
开发者ID:jenoya,项目名称:final,代码行数:56,代码来源:general-template.php

示例15: comments_popup_link

/**
 * Displays the link to the comments popup window for the current post ID.
 *
 * Is not meant to be displayed on single posts and pages. Should be used on the
 * lists of posts
 *
 * @since 0.71
 * @uses $id
 * @uses $wpcommentspopupfile
 * @uses $wpcommentsjavascript
 * @uses $post
 *
 * @param string $zero The string to display when no comments
 * @param string $one The string to display when only one comment is available
 * @param string $more The string to display when there are more than one comment
 * @param string $css_class The CSS class to use for comments
 * @param string $none The string to display when comments have been turned off
 * @return null Returns null on single posts and pages.
 */
function comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
    global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
    if (false === $zero) {
        $zero = __('No Comments');
    }
    if (false === $one) {
        $one = __('1 Comment');
    }
    if (false === $more) {
        $more = __('% Comments');
    }
    if (false === $none) {
        $none = __('Comments Off');
    }
    $number = get_comments_number($id);
    if (0 == $number && !comments_open() && !pings_open()) {
        echo '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
        return;
    }
    if (post_password_required()) {
        echo __('Enter your password to view comments');
        return;
    }
    echo '<a href="';
    if ($wpcommentsjavascript) {
        if (empty($wpcommentspopupfile)) {
            $home = get_option('home');
        } else {
            $home = get_option('siteurl');
        }
        echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
        echo '" onclick="wpopen(this.href); return false"';
    } else {
        // if comments_popup_script() is not in the template, display simple comment link
        if (0 == $number) {
            echo get_permalink() . '#respond';
        } else {
            comments_link();
        }
        echo '"';
    }
    if (!empty($css_class)) {
        echo ' class="' . $css_class . '" ';
    }
    $title = esc_attr(get_the_title());
    echo apply_filters('comments_popup_link_attributes', '');
    echo ' title="' . esc_attr(sprintf(__('Comment on %s'), $title)) . '">';
    comments_number($zero, $one, $more, $number);
    echo '</a>';
}
开发者ID:klr2003,项目名称:sourceread,代码行数:70,代码来源:comment-template.php


注:本文中的pings_open函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。