Exemple #1
0
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));
}
 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;
 }
Exemple #3
0
 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";
     }
 }
Exemple #4
0
 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";
     }
 }
Exemple #5
0
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;
}
Exemple #6
0
/**
 * 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);
}
Exemple #7
0
/**
 * 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']);
}
		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 );
		}
Exemple #9
0
    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();
    }
}
 /**
  * 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.'));
     }
     /**
      * Filter the pingback remote source.
      *
      * @since 2.5.0
      *
      * @param string $linea        Response object for the page linked from.
      * @param string $pagelinkedto URL of the page linked to.
      */
     $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
     // Work around bug in strip_tags():
     $linea = str_replace('<!DOC', '<DOC', $linea);
     $linea = preg_replace('/[\\r\\n\\t ]+/', ' ', $linea);
     // normalize spaces
     $linea = preg_replace("/<\\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea);
     preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
     $title = $matchtitle[1];
     if (empty($title)) {
         return $this->pingback_error(32, __('We cannot find a title on that page.'));
     }
     $linea = strip_tags($linea, '<a>');
     // just keep the tag we need
     $p = explode("\n\n", $linea);
     $preg_target = preg_quote($pagelinkedto, '|');
     foreach ($p as $para) {
         if (strpos($para, $pagelinkedto) !== false) {
             // it exists, but is it a link?
             preg_match("|<a[^>]+?" . $preg_target . "[^>]*>([^>]+?)</a>|", $para, $context);
             // If the URL isn't in a link context, keep looking
             if (empty($context)) {
                 continue;
             }
             // We're going to use this fake tag to mark the context in a bit
             // the marker is needed in case the link text appears more than once in the paragraph
             $excerpt = preg_replace('|\\</?wpcontext\\>|', '', $para);
             // prevent really long link text
             if (strlen($context[1]) > 100) {
                 $context[1] = substr($context[1], 0, 100) . '&#8230;';
             }
             $marker = '<wpcontext>' . $context[1] . '</wpcontext>';
             // set up our marker
             $excerpt = str_replace($context[0], $marker, $excerpt);
             // swap out the link for our marker
             $excerpt = strip_tags($excerpt, '<wpcontext>');
             // strip all tags but our context marker
             $excerpt = trim($excerpt);
             $preg_marker = preg_quote($marker, '|');
             $excerpt = preg_replace("|.*?\\s(.{0,100}{$preg_marker}.{0,100})\\s.*|s", '$1', $excerpt);
             $excerpt = strip_tags($excerpt);
             // YES, again, to remove the marker wrapper
             break;
         }
     }
     if (empty($context)) {
         // Link to target not found
         return $this->pingback_error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.'));
     }
     $pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
     $context = '[&#8230;] ' . esc_html($excerpt) . ' [&#8230;]';
     $pagelinkedfrom = $this->escape($pagelinkedfrom);
     $comment_post_ID = (int) $post_ID;
     $comment_author = $title;
     $comment_author_email = '';
     $this->escape($comment_author);
     $comment_author_url = $pagelinkedfrom;
     $comment_content = $context;
     $this->escape($comment_content);
     $comment_type = 'pingback';
     $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');
     $comment_ID = wp_new_comment($commentdata);
     /**
      * Fires after a post pingback has been sent.
      *
      * @since 0.71
      *
      * @param int $comment_ID Comment ID.
      */
     do_action('pingback_post', $comment_ID);
     return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
 }
 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;
 }
Exemple #12
0
 */
?>
<!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();
						</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(); ?>
Exemple #14
0
/**
 * 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";
    }
}
/**
 * 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>';
}
<?php 
} else {
    // If there are no comments yet
    ?>
	<p><?php 
    _e('No comments yet.');
    ?>
</p>
<?php 
}
?>

<p><?php 
comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'));
if (pings_open()) {
    ?>
	<a href="<?php 
    trackback_url();
    ?>
" rel="trackback"><?php 
    _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>');
    ?>
</a>
<?php 
}
?>
</p>

<?php 
if (comments_open()) {
Exemple #17
0
			<div class="comment-navigation paged-navigation">
				<?php 
        paginate_comments_links();
        ?>
			</div>
		<?php 
    }
    ?>

	</div><!-- #comments -->
<?php 
} else {
    ?>

	<?php 
    if (pings_open() && !comments_open() && (is_single() || is_page())) {
        ?>
		<p class="comments-closed pings-open">
			<?php 
        printf(__('Comments are closed, but <a href="%1$s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'framemarket'), trackback_url('0'));
        ?>
		</p>
	<?php 
    } elseif (!comments_open() && (is_single() || is_page())) {
        ?>
		<p class="comments-closed">
			<?php 
        _e('Comments are closed.', 'framemarket');
        ?>
		</p>
	<?php 
 */
do_action('dbx_post_advanced', $post);
// Allow the Discussion meta box to show up if the post type supports comments,
// or if comments or pings are open.
if (comments_open($post) || pings_open($post) || post_type_supports($post_type, 'comments')) {
    add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
}
$stati = get_post_stati(array('public' => true));
if (empty($stati)) {
    $stati = array('publish');
}
$stati[] = 'private';
if (in_array(get_post_status($post), $stati)) {
    // If the post type support comments, or the post has comments, allow the
    // Comments meta box.
    if (comments_open($post) || pings_open($post) || $post->comment_count > 0 || post_type_supports($post_type, 'comments')) {
        add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
    }
}
if (!('pending' == get_post_status($post) && !current_user_can($post_type_object->cap->publish_posts))) {
    add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
}
if (post_type_supports($post_type, 'author')) {
    if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts)) {
        add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
    }
}
/**
 * Fires after all built-in meta boxes have been added.
 *
 * @since 3.0.0
Exemple #19
0
    printf(esc_attr__('See all %1$s posts by %2$s', 'onemozilla'), the_author_posts(), the_author());
    ?>
"><?php 
    the_author();
    ?>
 <?php 
    echo get_avatar(get_the_author_meta('user_email'), 24);
    ?>
</a></cite></address>
  <?php 
}
?>

  <?php 
$comment_count = get_comments_number($post->ID);
if (comments_open() || pings_open() || $comment_count > 0) {
    ?>
    <p class="entry-comments"><a href="<?php 
    comments_link();
    ?>
" title="<?php 
    comments_number('No responses yet', '1 response', '% responses');
    ?>
"><?php 
    if ($comment_count > 999) {
        comments_number('0', '1', '1k+');
    } else {
        comments_number('0', '1', '%');
    }
    ?>
</a></p>
 public function sync_with_translations($post_id, $post_vars = false)
 {
     global $wpdb;
     $term_count_update = new WPML_Update_Term_Count();
     $post = get_post($post_id);
     $translated_ids = $this->post_translation->get_element_translations($post_id, false, true);
     $post_format = $this->sync_post_format ? get_post_format($post_id) : null;
     $ping_status = $this->sync_ping_status ? pings_open($post_id) ? 'open' : 'closed' : null;
     $comment_status = $this->sync_comment_status ? comments_open($post_id) ? 'open' : 'closed' : null;
     $post_password = $this->sync_password ? $post->post_password : null;
     $post_status = $this->sync_private_flag && get_post_status($post_id) === 'private' ? 'private' : null;
     $menu_order = $this->sync_menu_order && !empty($post->menu_order) ? $post->menu_order : null;
     $page_template = $this->sync_page_template && get_post_type($post_id) === 'page' ? get_page_template_slug($post_id) : null;
     $post_date = $this->sync_post_date ? $wpdb->get_var($wpdb->prepare("SELECT post_date FROM {$wpdb->posts} WHERE ID=%d LIMIT 1", $post_id)) : null;
     if ((bool) $post_vars === true) {
         $this->sync_sticky_flag($this->post_translation->get_element_trid($post_id), $post_vars);
     }
     foreach ($translated_ids as $lang_code => $translated_pid) {
         $this->sync_custom_fields($post_id, $translated_pid);
         if ($post_format !== null) {
             set_post_format($translated_pid, $post_format);
         }
         if ($post_date !== null) {
             $post_date_gmt = get_gmt_from_date($post_date);
             $data = array('post_date' => $post_date, 'post_date_gmt' => $post_date_gmt);
             $now = gmdate('Y-m-d H:i:59');
             if (mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false)) {
                 $post_status = 'future';
             } else {
                 $post_status = 'publish';
             }
             $data['post_status'] = $post_status;
             $wpdb->update($wpdb->posts, $data, array('ID' => $translated_pid));
         }
         if ($post_password !== null) {
             $wpdb->update($wpdb->posts, array('post_password' => $post_password), array('ID' => $translated_pid));
         }
         if ($post_status !== null && !in_array(get_post_status($translated_pid), array('auto-draft', 'draft', 'inherit', 'trash'))) {
             $wpdb->update($wpdb->posts, array('post_status' => $post_status), array('ID' => $translated_pid));
             $term_count_update->update_for_post($translated_pid);
         }
         if ($post_status == null && $this->sync_private_flag && get_post_status($translated_pid) == 'private') {
             $wpdb->update($wpdb->posts, array('post_status' => get_post_status($post_id)), array('ID' => $translated_pid));
             $term_count_update->update_for_post($translated_pid);
         }
         if ($ping_status !== null) {
             $wpdb->update($wpdb->posts, array('ping_status' => $ping_status), array('ID' => $translated_pid));
         }
         if ($comment_status !== null) {
             $wpdb->update($wpdb->posts, array('comment_status' => $comment_status), array('ID' => $translated_pid));
         }
         if ($page_template !== null) {
             update_post_meta($translated_pid, '_wp_page_template', $page_template);
         }
         $this->sync_with_translations($translated_pid);
     }
     if ($this->sync_parent) {
         $this->maybe_fix_translated_parent(get_post_type($post_id));
     }
     if ($menu_order !== null && (bool) $translated_ids !== false) {
         $wpdb->query("UPDATE {$wpdb->posts}\n\t\t\t\t   SET menu_order={$menu_order}\n\t\t\t\t   WHERE ID IN (" . wpml_prepare_in($translated_ids, '%d') . ")");
     }
 }
Exemple #21
0
					<?php 
    wp_list_comments(hybrid_list_comments_args());
    ?>
				</ol><!-- .comment-list -->

				<?php 
    do_atomic('after_comment_list');
    // my-life_after_comment_list
    ?>

			<?php 
}
?>

			<?php 
if (pings_open() && !comments_open()) {
    ?>

				<p class="comments-closed pings-open">
					<?php 
    printf(__('Comments are closed, but <a href="%s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'my-life'), esc_url(get_trackback_url()));
    ?>
				</p><!-- .comments-closed .pings-open -->

			<?php 
} elseif (!comments_open()) {
    ?>

				<p class="comments-closed">
					<?php 
    _e('Comments are closed.', 'my-life');
Exemple #22
0
 function et_get_comments_popup_link($zero = false, $one = false, $more = false)
 {
     global $themename;
     $id = get_the_ID();
     $number = get_comments_number($id);
     if (0 == $number && !comments_open() && !pings_open()) {
         return;
     }
     if ($number > 1) {
         $output = str_replace('%', number_format_i18n($number), false === $more ? __('% Comments', $themename) : $more);
     } elseif ($number == 0) {
         $output = false === $zero ? __('No Comments', $themename) : $zero;
     } else {
         // must be one
         $output = false === $one ? __('1 Comment', $themename) : $one;
     }
     return '<span class="comments-number">' . '<a href="' . esc_url(get_permalink() . '#respond') . '">' . apply_filters('comments_number', $output, $number) . '</a>' . '</span>';
 }
Exemple #23
0
      </form>

     </div>
     <!-- /comment form -->
     <?php 
        }
    }
    ?>
  </div>
  <!-- /comments -->
  <?php 
}
?>

  <?php 
if (pings_open() && $jquery) {
    ?>
  <!-- trackbacks -->
	<div class="section" id="section-trackbacks">
     <?php 
    if ($numPingBacks > 0) {
        ?>
     <ul id="trackbacks">
     <?php 
        wp_list_comments('type=pings&callback=mystique_list_pings');
        ?>
    </ul>
    <?php 
    } else {
        ?>
    <h6 class="title"><?php 
 /**
  * Retrieves a pingback and registers it.
  *
  * @since 1.5.0
  *
  * @param array $args Method parameters.
  * @return array
  */
 function pingback_ping($args)
 {
     global $wpdb;
     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);
     // 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 new IXR_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 = 'url_to_postid()';
     } elseif (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];
         $way = 'from the path';
     } elseif (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];
         $way = 'from the querystring';
     } 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'];
             $way = 'from the fragment (numeric)';
         } elseif (preg_match('/post-[0-9]+/', $urltest['fragment'])) {
             // ...a post id in the form 'post-###'
             $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
             $way = 'from the fragment (post-###)';
         } 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", like_escape($title));
             if (!($post_ID = $wpdb->get_var($sql))) {
                 // returning unknown error '0' is better than die()ing
                 return new IXR_Error(0, '');
             }
             $way = 'from the fragment (title)';
         }
     } else {
         // TODO: Attempt to extract a post ID from the given URL
         return new IXR_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 new IXR_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 new IXR_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 new IXR_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 new IXR_Error(48, __('The pingback has already been registered.'));
     }
     // very stupid, but gives time to the 'from' server to publish !
     sleep(1);
     // Let's check the remote site
     $linea = wp_remote_fopen($pagelinkedfrom);
     if (!$linea) {
         return new IXR_Error(16, __('The source URL does not exist.'));
     }
     $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
     // Work around bug in strip_tags():
     $linea = str_replace('<!DOC', '<DOC', $linea);
     $linea = preg_replace('/[\\s\\r\\n\\t]+/', ' ', $linea);
     // normalize spaces
     $linea = preg_replace("/ <(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea);
     preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
     $title = $matchtitle[1];
     if (empty($title)) {
         return new IXR_Error(32, __('We cannot find a title on that page.'));
     }
     $linea = strip_tags($linea, '<a>');
     // just keep the tag we need
     $p = explode("\n\n", $linea);
     $preg_target = preg_quote($pagelinkedto, '|');
     foreach ($p as $para) {
         if (strpos($para, $pagelinkedto) !== false) {
             // it exists, but is it a link?
             preg_match("|<a[^>]+?" . $preg_target . "[^>]*>([^>]+?)</a>|", $para, $context);
             // If the URL isn't in a link context, keep looking
             if (empty($context)) {
                 continue;
             }
             // We're going to use this fake tag to mark the context in a bit
             // the marker is needed in case the link text appears more than once in the paragraph
             $excerpt = preg_replace('|\\</?wpcontext\\>|', '', $para);
             // prevent really long link text
             if (strlen($context[1]) > 100) {
                 $context[1] = substr($context[1], 0, 100) . '...';
             }
             $marker = '<wpcontext>' . $context[1] . '</wpcontext>';
             // set up our marker
             $excerpt = str_replace($context[0], $marker, $excerpt);
             // swap out the link for our marker
             $excerpt = strip_tags($excerpt, '<wpcontext>');
             // strip all tags but our context marker
             $excerpt = trim($excerpt);
             $preg_marker = preg_quote($marker, '|');
             $excerpt = preg_replace("|.*?\\s(.{0,100}{$preg_marker}.{0,100})\\s.*|s", '$1', $excerpt);
             $excerpt = strip_tags($excerpt);
             // YES, again, to remove the marker wrapper
             break;
         }
     }
     if (empty($context)) {
         // Link to target not found
         return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.'));
     }
     $pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
     $context = '[...] ' . esc_html($excerpt) . ' [...]';
     $pagelinkedfrom = $wpdb->escape($pagelinkedfrom);
     $comment_post_ID = (int) $post_ID;
     $comment_author = $title;
     $comment_author_email = '';
     $this->escape($comment_author);
     $comment_author_url = $pagelinkedfrom;
     $comment_content = $context;
     $this->escape($comment_content);
     $comment_type = 'pingback';
     $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');
     $comment_ID = wp_new_comment($commentdata);
     do_action('pingback_post', $comment_ID);
     return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
 }
				<?php wp_list_comments( hybrid_list_comments_args() ); ?>
			</ul><!-- .comment-list -->

			<?php do_atomic( 'after_comment_list' ); // After comment list hook ?>

			<?php if ( get_option( 'page_comments' ) ) : ?>
				<div class="comment-navigation comment-pagination paged-navigation">
					<?php paginate_comments_links(); ?>
				</div><!-- .comment-navigation -->
			<?php endif; ?>

		</div><!-- #comments -->

	<?php else : ?>

		<?php if ( pings_open() && !comments_open() ) : ?>

			<p class="comments-closed pings-open">
				<?php printf( __( 'Comments are closed, but <a href="%1$s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', hybrid_get_parent_textdomain() ), trackback_url( '0' ) ); ?>
			</p><!-- .comments-closed .pings-open -->

		<?php endif; ?>

	<?php endif; ?>
	
	<?php 	//modify comment form
			$args = array( 	'title_reply' => __('Leave a comment'),
							'label_submit' => __('Submit'),
						);
	?>
Exemple #26
0
    the_content();
    ?>
		<!-- end .entry-content --></div>
		<?php 
    do_action('habakiri_after_entry_content');
    ?>
	<!-- end .entry --></div>
	
	<?php 
    Habakiri::the_link_pages();
    ?>
	<?php 
    Habakiri::the_related_posts();
    ?>
	<?php 
    if (comments_open() || pings_open() || get_comments_number()) {
        comments_template('', true);
    }
    ?>
</article>

<?php 
} else {
    ?>

<article <?php 
    post_class(array('article'));
    ?>
>

	<?php 
</p>

				<p class="next-comment"><?php 
        next_comments_link();
        ?>
</p>
			</nav>
		<?php 
    }
    ?>
		<?php 
    comment_form();
    ?>
	</section>
	<?php 
} elseif (!comments_open() && have_comments() && pings_open()) {
    ?>
	<section id="comments" class="comments">
		<div class="comments-number">
			<h3>
				<?php 
    comments_number(__('Comments', 'founder'), __('One Comment', 'founder'), __('% Comments', 'founder'));
    ?>
			</h3>
		</div>
		<ol class="comment-list">
			<?php 
    wp_list_comments(array('callback' => 'ct_founder_customize_comments', 'max_depth' => '3'));
    ?>
		</ol>
		<?php 
/**
 * Displays the link to the comments for the current post ID.
 *
 * @since 0.71
 *
 * @param string $zero      Optional. String to display when no comments. Default false.
 * @param string $one       Optional. String to display when only one comment is available.
 *                          Default false.
 * @param string $more      Optional. String to display when there are more than one comment.
 *                          Default false.
 * @param string $css_class Optional. CSS class to use for comments. Default empty.
 * @param string $none      Optional. String to display when comments have been turned off.
 *                          Default false.
 */
function comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
    $id = get_the_ID();
    $title = get_the_title();
    $number = get_comments_number($id);
    if (false === $zero) {
        /* translators: %s: post title */
        $zero = sprintf(__('No Comments<span class="screen-reader-text"> on %s</span>'), $title);
    }
    if (false === $one) {
        /* translators: %s: post title */
        $one = sprintf(__('1 Comment<span class="screen-reader-text"> on %s</span>'), $title);
    }
    if (false === $more) {
        /* translators: 1: Number of comments 2: post title */
        $more = _n('%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number);
        $more = sprintf($more, number_format_i18n($number), $title);
    }
    if (false === $none) {
        /* translators: %s: post title */
        $none = sprintf(__('Comments Off<span class="screen-reader-text"> on %s</span>'), $title);
    }
    if (0 == $number && !comments_open() && !pings_open()) {
        echo '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
        return;
    }
    if (post_password_required()) {
        _e('Enter your password to view comments.');
        return;
    }
    echo '<a href="';
    if (0 == $number) {
        $respond_link = get_permalink() . '#respond';
        /**
         * Filter the respond link when a post has no comments.
         *
         * @since 4.4.0
         *
         * @param string $respond_link The default response link.
         * @param integer $id The post ID.
         */
        echo apply_filters('respond_link', $respond_link, $id);
    } else {
        comments_link();
    }
    echo '"';
    if (!empty($css_class)) {
        echo ' class="' . $css_class . '" ';
    }
    $attributes = '';
    /**
     * Filter the comments link attributes for display.
     *
     * @since 2.5.0
     *
     * @param string $attributes The comments link attributes. Default empty.
     */
    echo apply_filters('comments_popup_link_attributes', $attributes);
    echo '>';
    comments_number($zero, $one, $more);
    echo '</a>';
}
function waves_get_comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
    global $wpcommentspopupfile, $wpcommentsjavascript;
    $id = get_the_ID();
    $title = get_the_title();
    $number = get_comments_number($id);
    if (false === $zero) {
        /* translators: %s: post title */
        $zero = sprintf(__('No Comments<span class="screen-reader-text"> on %s</span>', 'waves'), $title);
    }
    if (false === $one) {
        /* translators: %s: post title */
        $one = sprintf(__('1 Comment<span class="screen-reader-text"> on %s</span>', 'waves'), $title);
    }
    if (false === $more) {
        /* translators: 1: Number of comments 2: post title */
        $more = _n('%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number, 'waves');
        $more = sprintf($more, number_format_i18n($number), $title);
    }
    if (false === $none) {
        /* translators: %s: post title */
        $none = sprintf(__('Comments Off<span class="screen-reader-text"> on %s</span>', 'waves'), $title);
    }
    if (0 == $number && !comments_open() && !pings_open()) {
        return '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
    }
    if (post_password_required()) {
        return __('Enter your password to view comments.', 'waves');
    }
    $link_anchor = '<a href="';
    if ($wpcommentsjavascript) {
        if (empty($wpcommentspopupfile)) {
            $home = home_url();
        } else {
            $home = get_option('siteurl');
        }
        $link_anchor .= $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
        $link_anchor .= '" onclick="wpopen(this.href); return false"';
    } else {
        if (0 == $number) {
            $link_anchor .= get_permalink() . '#respond';
        } else {
            $link_anchor .= get_comments_link();
        }
        $link_anchor .= '"';
    }
    if (!empty($css_class)) {
        $link_anchor .= ' class="' . $css_class . '" ';
    }
    $attributes = '';
    $link_anchor .= apply_filters('comments_popup_link_attributes', $attributes);
    $link_anchor .= '>';
    $link_anchor .= get_comments_number_text($zero, $one, $more);
    $link_anchor .= '</a>';
    return $link_anchor;
}
/**
 * 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
 *
 * @global string $wpcommentspopupfile The URL to use for the popup window.
 * @global int $wpcommentsjavascript Whether to use JavaScript. Set when function is called.
 *
 * @since 0.71
 *
 * @param string $zero Optional. String to display when no comments. Default false.
 * @param string $one Optional. String to display when only one comment is available.
 *                          Default false.
 * @param string $more Optional. String to display when there are more than one comment.
 *                          Default false.
 * @param string $css_class Optional. CSS class to use for comments. Default empty.
 * @param string $none Optional. String to display when comments have been turned off.
 *                          Default false.
 */
function comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
    global $wpcommentspopupfile, $wpcommentsjavascript;
    $id = get_the_ID();
    $title = get_the_title();
    $number = get_comments_number($id);
    if (false === $zero) {
        /* translators: %s: post title */
        $zero = sprintf(__('No Comments<span class="screen-reader-text"> on %s</span>'), $title);
    }
    if (false === $one) {
        /* translators: %s: post title */
        $one = sprintf(__('1 Comment<span class="screen-reader-text"> on %s</span>'), $title);
    }
    if (false === $more) {
        /* translators: 1: Number of comments 2: post title */
        $more = _n('%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number);
        $more = sprintf($more, number_format_i18n($number), $title);
    }
    if (false === $none) {
        /* translators: %s: post title */
        $none = sprintf(__('Comments Off<span class="screen-reader-text"> on %s</span>'), $title);
    }
    if (0 == $number && !comments_open() && !pings_open()) {
        echo '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
        return;
    }
    if (post_password_required()) {
        _e('Enter your password to view comments.');
        return;
    }
    echo '<a href="';
    if ($wpcommentsjavascript) {
        if (empty($wpcommentspopupfile)) {
            $home = home_url();
        } 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 . '" ';
    }
    $attributes = '';
    /**
     * Filter the comments popup link attributes for display.
     *
     * @since 2.5.0
     *
     * @param string $attributes The comments popup link attributes. Default empty.
     */
    echo apply_filters('comments_popup_link_attributes', $attributes);
    echo '>';
    comments_number($zero, $one, $more);
    echo '</a>';
}