Exemplo n.º 1
1
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function square_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     $comment_count = get_comments_number();
     // get_comments_number returns only a numeric value
     if (comments_open()) {
         if ($comment_count == 0) {
             $comments = __('No Comments', 'square');
         } elseif ($comment_count > 1) {
             $comments = $comment_count . __(' Comments', 'square');
         } else {
             $comments = __('1 Comment', 'square');
         }
         $comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
     } else {
         $comment_link = __(' Comment Closed', 'square');
     }
     echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
     // WPCS: XSS OK.
 }
Exemplo n.º 2
0
 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? $instance['title'] : '';
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     $name = get_the_author_meta('display_name', $post->post_author);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'myThemes'), '<li>', '</li>');
     echo '<li><a href="' . get_day_link(get_post_time('Y', false, $post->ID), get_post_time('m', false, $post->ID), get_post_time('d', false, $post->ID)) . '">';
     echo '<time datetime="' . get_post_time('Y-m-d', false, $post->ID) . '"><i class="icon-calendar"></i>' . get_post_time(get_option('date_format'), false, $post->ID) . '</time></a></li>';
     echo '<li><a href="' . get_author_posts_url($post->post_author) . '" title="' . __('Writed by ', 'myThemes') . ' ' . $name . '"><i class="icon-user-5"></i>' . $name . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         if ($nr == 1) {
             $comments = $nr . ' ' . __('Comment', 'myThemes');
         } else {
             $comments = $nr . ' ' . __('Comments', 'myThemes');
         }
         echo '<li><a href="' . get_comments_link($post->ID) . '"><i class="icon-comment"></i>' . $comments . '</a></li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
Exemplo n.º 3
0
 /**
  * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
  *
  * @return void
  */
 function wheels_entry_meta()
 {
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'wheels') . '</span>';
     }
     if (!has_post_format('link') && 'post' == get_post_type()) {
         wheels_entry_date();
     }
     // Translators: used between list items, there is a space after the comma.
     $categories_list = get_the_category_list(__(', ', 'wheels'));
     if ($categories_list) {
         echo '/<span class="categories-links">' . $categories_list . '</span>';
     }
     // Translators: used between list items, there is a space after the comma.
     $tag_list = get_the_tag_list('', __(', ', 'wheels'));
     if ($tag_list) {
         echo '/<span class="tags-links">' . $tag_list . '</span>';
     }
     // Post author
     if ('post' == get_post_type()) {
         printf('/<span class="author vcard">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author">%4$s</a></span>', __('by', 'wheels'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'wheels'), get_the_author())), get_the_author());
         $num_comments = get_comments_number();
         // get_comments_number returns only a numeric value
         if ($num_comments == 0) {
         } else {
             if ($num_comments > 1) {
                 $comments = $num_comments . __(' Comments', 'wheels');
             } else {
                 $comments = __('1 Comment', 'wheels');
             }
             echo $write_comments = '/<span class="comments-count"><a href="' . get_comments_link() . '">' . $comments . '</a></span>';
         }
     }
 }
Exemplo n.º 4
0
function ts_recentposts($atts, $content = null)
{
    extract(shortcode_atts(array("title" => '', "cat" => '', "longchar" => 130), $atts));
    $content = ts_remove_autop($content);
    $output = '';
    if ($title != "") {
        $output .= '<h2 class="title_pattern uppercase"><span>' . $title . '</span></h2>';
    }
    $i = 1;
    query_posts("showposts=4&category_name=" . $cat);
    global $post;
    $output .= '<ul id="recentpost">';
    while (have_posts()) {
        the_post();
        if ($i % 4 == 0) {
            $addclass = "last";
        } else {
            $addclass = "";
        }
        $excerpt = get_the_excerpt();
        //get_comment
        $num_comments = get_comments_number();
        // for some reason get_comments_number only returns a numeric value displaying the number of comments
        if (comments_open()) {
            if ($num_comments == 0) {
                $comments = __('No Comments', 'templatesquare');
            } elseif ($num_comments > 1) {
                $comments = $num_comments . __(' Comments', 'templatesquare');
            } else {
                $comments = "1 Comment";
            }
            $write_comments = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
        } else {
            $write_comments = __('Comments off', 'templatesquare');
        }
        //get blog post thumb
        $custom = get_post_custom($post->ID);
        $cf_thumb = isset($custom["thumb"][0]) ? $custom["thumb"][0] : "";
        if ($cf_thumb != "") {
            $thumb = '<img src=' . $cf_thumb . ' alt="" width="210" height="158" class="frame"/><span class="shadowimg220"></span>';
        } elseif (has_post_thumbnail($post->ID)) {
            $thumb = get_the_post_thumbnail($post->ID, 'blog-post-thumb', array('alt' => '', 'class' => 'frame')) . '<span class="shadowimg220"></span>';
        } else {
            $thumb = "";
        }
        $output .= '<li class="' . $addclass . '">';
        $output .= $thumb;
        $output .= '<div class="entry-date">' . get_the_time('d/m/y') . ' - ' . $write_comments . '</div>';
        $output .= '<h5 class="colortext"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>';
        $output .= '<span>' . ts_string_limit_char($excerpt, $longchar) . '</span>';
        $output .= '</li>';
        $i++;
        $addclass = "";
    }
    wp_reset_query();
    $output .= '</ul>';
    $output .= '<div class="clear"></div>';
    return do_shortcode($output);
}
Exemplo n.º 5
0
function theme_latest_news($atts, $content)
{
    global $themename;
    extract(shortcode_atts(array("count" => 2, "category" => "", "order" => "DESC"), $atts));
    query_posts(array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'cat' => $category, 'order' => $order));
    $output = '<ul class="blog clearfix">';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $post_classes = get_post_class("post");
            $output .= '<li class="';
            foreach ($post_classes as $key => $post_class) {
                $output .= $post_class . ($key + 1 < count($post_classes) ? ' ' : '');
            }
            $output .= '">
						<div class="comment_box">
							<div class="first_row">
								' . get_the_time("d") . '<span class="second_row">' . strtoupper(get_the_time("M")) . '</span>
							</div>';
            $comments_count = get_comments_number();
            $output .= '		<a class="comments_number" href="' . get_comments_link() . '" title="' . $comments_count . ($comments_count == 1 ? ' ' . __('Comment', $themename) : ' ' . __('Comments', $themename)) . '">' . $comments_count . ($comments_count == 1 ? ' ' . __('Comment', $themename) : ' ' . __('Comments', $themename)) . '</a>
						</div>
						<div class="post_content">';
            if (has_post_thumbnail()) {
                $output .= '<a class="post_image" href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail(get_the_ID(), "blog-post-thumb", array("alt" => get_the_title(), "title" => "")) . '</a>';
            }
            $output .= '		<h2>
								<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a>
							</h2>
							<div class="text">
								' . apply_filters('the_excerpt', get_the_excerpt()) . '
							</div>
							<div class="post_footer">
								<ul class="categories">
									<li class="posted_by">' . __('Posted by', $themename) . ' <a class="author" href="' . get_the_author_link() . '" title="' . get_the_author() . '">' . get_the_author() . '</a></li>';
            $categories = get_the_category();
            foreach ($categories as $key => $category) {
                $output .= '<li>
											<a href="' . get_category_link($category->term_id) . '" ';
                if (empty($category->description)) {
                    $output .= 'title="' . sprintf(__('View all posts filed under %s', $themename), $category->name) . '"';
                } else {
                    $output .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
                }
                $output .= '>' . $category->name . '</a>
										</li>';
            }
            $output .= '			</ul>
								<a class="more icon_small_arrow margin_right_white" href="' . get_permalink() . '" title="' . __("More", $themename) . '">' . __("More", $themename) . '</a>
							</div>
						</div>
					</li>';
        }
    }
    $output .= '</ul>';
    //Reset Query
    wp_reset_query();
    return $output;
}
Exemplo n.º 6
0
 /**
  * Returns HTML with comments count if there are any.
  *
  * @return string Comments count.
  */
 function gently_comments_count()
 {
     /* Display comments count only if the are available. */
     if (!post_password_required() && (comments_open() || get_comments_number())) {
         return sprintf('<a class="comments-count" href="' . get_comments_link() . '"><span class="screen-reader-text">%s</span><i class="fa fa-comments" aria-hidden="true"></i>&nbsp;' . get_comments_number() . '</a>', esc_html__('Comments count', 'gently'));
     }
     return '';
 }
Exemplo n.º 7
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $categories = empty($instance['categories']) ? $instance['categories'] : implode($instance['categories'], ',');
     $count = empty($instance['count']) ? 5 : $instance['count'];
     $limit = empty($instance['limit']) ? 100 : $instance['limit'];
     $show_thumbnails = $instance['show_thumbnails'];
     $show_excerpt = $instance['show_excerpt'];
     $all_post_formats = $instance['all_post_formats'];
     $thumb_width = empty($instance['thumb_width']) ? 50 : $instance['thumb_width'];
     $thumb_height = empty($instance['thumb_height']) ? 50 : $instance['thumb_height'];
     //remove aside and quote post formats from the list
     $postargs = $all_post_formats ? array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1) : array('orderby' => 'comment_count', 'tax_query' => array(array('operator' => 'NOT IN', 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote', 'post-format-aside'))), 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
     $post_query = new WP_Query($postargs);
     $rt_posts = '<div class="recent_posts clearfix"><ul>';
     if ($post_query->have_posts()) {
         while ($post_query->have_posts()) {
             $post_query->the_post();
             $post_title = get_the_title();
             $link = get_permalink();
             $date = get_the_time('d M Y');
             $comment_count = get_comment_count($post_query->post->ID);
             $rt_gallery_images = get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_images", true) ? get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_images", true) : "";
             $rt_gallery_image_titles = get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_titles", true) ? get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_titles", true) : "";
             $rt_gallery_image_descs = get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_descs", true) ? get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_descs", true) : "";
             $fist_featured_image = is_array($rt_gallery_images) ? find_image_org_path($rt_gallery_images[0]) : "";
             $rt_posts .= '<li class="clearfix">';
             if ($fist_featured_image && !$show_thumbnails) {
                 $f_image = @vt_resize('', $fist_featured_image, $thumb_width, $thumb_height, true);
                 if ($f_image["url"]) {
                     $rt_posts .= '<img src="' . $f_image["url"] . '" alt="' . $title . '" class="recent-posts-thumb" />';
                 }
             }
             $rt_posts .= '<span class="date">' . $date . '</span>';
             $rt_posts .= '<span class="title"><a href="' . $link . '">' . $post_title . '</a></span>';
             $rt_posts .= $show_excerpt ? '' . wp_html_excerpt(get_the_excerpt(), $limit) . '...' : "";
             if ($comment_count['approved'] > 0) {
                 if ($comment_count['approved'] > 1) {
                     $comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
                 } else {
                     $comments = __('1 Comment', 'rt_theme');
                 }
                 $rt_posts .= ' <span class="comment_number date"><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comments . '</a></span>';
                 $rt_posts .= $show_excerpt ? '<div class="space margin-b10"></div>' : "";
             }
             $rt_posts .= '</li>';
         }
     }
     wp_reset_query();
     $rt_posts .= '</ul></div>';
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo $rt_posts;
     echo $after_widget;
 }
        function widget($args, $instance)
        {
            //defaults
            $instance = wp_parse_args($instance, array("title" => "", "categories" => "", "count" => "", "limit" => "", "show_thumbnails" => "", "show_excerpt" => "", "thumb_width" => "", "thumb_height" => ""));
            extract($args);
            $title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : "";
            $categories = !empty($instance['categories']) ? implode($instance['categories'], ',') : "";
            $count = !empty($instance['count']) ? $instance['count'] : 5;
            $limit = !empty($instance['limit']) ? $instance['limit'] : 100;
            $show_thumbnails = !empty($instance['show_thumbnails']) ? $instance['show_thumbnails'] : "";
            $show_excerpt = !empty($instance['show_excerpt']) ? $instance['show_excerpt'] : "";
            $thumb_width = !empty($instance['thumb_width']) ? $instance['thumb_width'] : 260;
            $thumb_height = !empty($instance['thumb_height']) ? $instance['thumb_height'] : 260;
            $comment = "";
            //remove aside and quote post formats from the list
            $postargs = array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
            $post_query = new WP_Query($postargs);
            $rt_posts = '';
            if ($post_query->have_posts()) {
                while ($post_query->have_posts()) {
                    $post_query->the_post();
                    $post_title = get_the_title();
                    $link = get_permalink();
                    $date = get_the_time('d M Y');
                    $comment_count = get_comment_count($post_query->post->ID);
                    $featured_image_id = get_post_thumbnail_id();
                    $get_the_excerpt = $show_excerpt ? '<p>' . wp_html_excerpt(get_the_excerpt(), $limit) . '...</p>' : "";
                    // Create thumbnail image
                    $thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "post-thumb")) : "";
                    if (empty($thumbnail_image_output) || !empty($show_thumbnails)) {
                        $thumbnail_image_output = "";
                    }
                    if ($comment_count['approved'] > 0) {
                        if ($comment_count['approved'] > 1) {
                            $comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
                        } else {
                            $comments = __('1 Comment', 'rt_theme');
                        }
                        $comment = ' | <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
                    }
                    $rt_posts .= sprintf('
				<div>
					%1$s
						<a class="title" href="%2$s" title="%3$s" rel="bookmark">%3$s</a>
						<span class="meta">%4$s %6$s</span>
					%5$s
				</div>
			', $thumbnail_image_output, $link, $post_title, get_the_date(), $get_the_excerpt, $comment);
                }
                wp_reset_postdata();
            }
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo $rt_posts;
            echo $after_widget;
        }
Exemplo n.º 9
0
/**
 * Prints HTML with article's footer. 
 * 
 */
function lady_B_post_footer($show_comments_template = false, $show_no_comment_info = true)
{
    //check comments
    $num_comments = get_comments_number();
    // get_comments_number returns only a numeric value
    if (comments_open()) {
        if ($num_comments == 0) {
            $comments = __('No comments', 'lady_B');
        } elseif ($num_comments > 1) {
            $comments = $num_comments . __(' comments', 'lady_B');
        } else {
            $comments = __('1 comment', 'lady_B');
        }
        $comments_txt = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
    } else {
        if ($show_no_comment_info) {
            $comments_txt = __('Comments are off for this post.', 'lady_B');
        } else {
            $comments_txt = '';
        }
    }
    //check tags
    $separator = ', ';
    $posttags = get_the_tags();
    $mtags = "";
    if ($posttags) {
        $mtags = __('Tags: ', 'lady_B');
        foreach ($posttags as $tag) {
            $mtags .= '<a href="' . esc_url(get_tag_link($tag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts tagged %s', 'lady_B'), $tag->name)) . '">' . esc_html($tag->name) . '</a>' . $separator;
        }
        $mtags .= "<br/>";
    }
    //check categories
    $mcat = "";
    $postcat = get_the_category();
    if ($postcat) {
        $mcat = __('In: ', 'lady_B');
        foreach ($postcat as $category) {
            $mcat .= '<a href="' . esc_url(get_category_link($category->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'lady_B'), $category->name)) . '">' . esc_html($category->name) . '</a>' . $separator;
        }
    }
    //we need different layout for single.php
    if ($show_comments_template) {
        $template = "";
        if (comments_open() || get_comments_number()) {
            ob_start();
            comments_template();
            $template = ob_get_contents();
            // Store buffer in variable
            ob_end_clean();
        }
        print "</div><!--end of entry--><footer><p class='more'>" . $mtags . $mcat . "</p><p class='comments'>" . $comments_txt . "</p>" . $template . "</footer></article><!--end of post-->";
    } else {
        print "</div><!--end of entry--><footer><p class='comments'>" . $comments_txt . "</p><p class='more'>" . $mtags . $mcat . "</p></footer></article><!--end of post-->";
    }
}
Exemplo n.º 10
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));
}
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 12
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $categories = empty($instance['categories']) ? $instance['categories'] : implode($instance['categories'], ',');
     $count = empty($instance['count']) ? 5 : $instance['count'];
     $limit = empty($instance['limit']) ? 100 : $instance['limit'];
     $show_thumbnails = $instance['show_thumbnails'];
     $show_excerpt = $instance['show_excerpt'];
     $thumb_width = empty($instance['thumb_width']) ? 50 : $instance['thumb_width'];
     $thumb_height = empty($instance['thumb_height']) ? 50 : $instance['thumb_height'];
     $comment = "";
     //remove aside and quote post formats from the list
     $postargs = array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
     $post_query = new WP_Query($postargs);
     $rt_posts = '<div class="recent_posts clearfix"><ul>';
     if ($post_query->have_posts()) {
         while ($post_query->have_posts()) {
             $post_query->the_post();
             $post_title = get_the_title();
             $link = get_permalink();
             $date = get_the_time('d M Y');
             $comment_count = get_comment_count($post_query->post->ID);
             $featured_image_id = get_post_thumbnail_id();
             // Create thumbnail image
             $thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "recent-posts-thumb")) : "";
             $rt_posts .= '<li class="clearfix">';
             if ($thumbnail_image_output && !$show_thumbnails) {
                 $rt_posts .= $thumbnail_image_output;
             }
             if ($comment_count['approved'] > 0) {
                 if ($comment_count['approved'] > 1) {
                     $comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
                 } else {
                     $comments = __('1 Comment', 'rt_theme');
                 }
                 $comment = ' <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
             }
             $rt_posts .= '<span class="title"><a href="' . $link . '">' . $post_title . '</a></span>';
             $rt_posts .= '<div class="widget-meta"><span class="date">' . $date . '</span> ' . $comment . '</div>';
             $rt_posts .= $show_excerpt ? '' . wp_html_excerpt(get_the_excerpt(), $limit) . '...' . '<div class="space margin-b10"></div>' : "";
             $rt_posts .= '</li>';
         }
     }
     wp_reset_query();
     $rt_posts .= '</ul></div>';
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo $rt_posts;
     echo $after_widget;
 }
Exemplo n.º 13
0
 function x_integrity_entry_meta()
 {
     $author = sprintf('<span><i class="x-icon-pencil"></i> %s</span>', get_the_author());
     $date = sprintf('<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar"></i> %2$s</time></span>', esc_attr(get_the_date('c')), esc_html(get_the_date()));
     if (get_post_type() == 'x-portfolio') {
         if (has_term('', 'portfolio-category', NULL)) {
             $categories = get_the_terms(get_the_ID(), 'portfolio-category');
             $separator = ', ';
             $categories_output = '';
             foreach ($categories as $category) {
                 $categories_output .= '<a href="' . get_term_link($category->slug, 'portfolio-category') . '" title="' . esc_attr(sprintf(__("View all posts in: &ldquo;%s&rdquo;", '__x__'), $category->name)) . '"><i class="x-icon-bookmark"></i> ' . $category->name . '</a>' . $separator;
             }
             $categories_list = sprintf('<span>%s</span>', trim($categories_output, $separator));
         } else {
             $categories_list = '';
         }
     } else {
         $categories = get_the_category();
         $separator = ', ';
         $categories_output = '';
         foreach ($categories as $category) {
             $categories_output .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in: &ldquo;%s&rdquo;", '__x__'), $category->name)) . '"><i class="x-icon-bookmark"></i> ' . $category->name . '</a>' . $separator;
         }
         $categories_list = sprintf('<span>%s</span>', trim($categories_output, $separator));
     }
     if (comments_open()) {
         $title = get_the_title();
         $link = get_comments_link();
         $number = get_comments_number();
         if ($number == 0) {
             $comments = sprintf('<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>', esc_url($link), esc_attr(sprintf(__('Leave a comment on: &ldquo;%s&rdquo;', '__x__'), $title)), __('Leave a Comment', '__x__'));
         } else {
             if ($number == 1) {
                 $comments = sprintf('<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>', esc_url($link), esc_attr(sprintf(__('Leave a comment on: &ldquo;%s&rdquo;', '__x__'), $title)), $number . ' ' . __('Comment', '__x__'));
             } else {
                 $comments = sprintf('<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>', esc_url($link), esc_attr(sprintf(__('Leave a comment on: &ldquo;%s&rdquo;', '__x__'), $title)), $number . ' ' . __('Comments', '__x__'));
             }
         }
     } else {
         $comments = '';
     }
     $post_type = get_post_type();
     $post_type_post = $post_type == 'post';
     $post_type_portfolio = $post_type == 'x-portfolio';
     $no_post_meta = get_theme_mod('x_blog_enable_post_meta') == 0;
     $no_portfolio_meta = get_theme_mod('x_portfolio_enable_post_meta') == 0;
     if ($post_type_post && $no_post_meta || $post_type_portfolio && $no_portfolio_meta) {
         return;
     } else {
         printf('<p class="p-meta">%1$s%2$s%3$s%4$s</p>', $author, $date, $categories_list, $comments);
     }
 }
Exemplo n.º 14
0
/** DistinctPress Post Comments */
function distinctpress_post_comments()
{
    if (!comments_open() || post_password_required()) {
        return;
    }
    ob_start();
    comments_number(__('Leave a Comment', 'distinctpress'), __('1 Comment', 'distinctpress'), __('% Comments', 'distinctpress'));
    $comments = ob_get_clean();
    /** Output */
    $comments = sprintf('<a href="%s"><i class="el-icon-comment meta-icon"></i>%s</a>', esc_url(get_comments_link()), $comments);
    $output = sprintf('<span class="entry-meta-sep"> &sdot; </span><span class="comments-link">%1$s</span>', $comments);
    return $output;
}
Exemplo n.º 15
0
/** Contango Post Comments */
function contango_post_comments()
{
    if (!comments_open() || post_password_required()) {
        return;
    }
    ob_start();
    comments_number(__('Leave a Comment', 'contango'), __('1 Comment', 'contango'), __('% Comments', 'contango'));
    $comments = ob_get_clean();
    /** Output */
    $comments = sprintf('<a href="%s">%s</a>', esc_url(get_comments_link()), $comments);
    $output = sprintf('%2$s<span class="comments-link">%1$s</span>', $comments, contango_entry_meta_sep());
    return $output;
}
 /**
  *  Prints HTML with meta information for the current post-date/time and author on archive.
  */
 public function archive_entry_meta_output()
 {
     global $post;
     $number_comments = get_comments_number();
     $post_standard_enable_author = get_theme_mod('illdy_post_standard_enable_author', 1);
     $output = '';
     $output .= '<div class="blog-post-meta">';
     $output .= $post_standard_enable_author == 1 ? '<span class="post-meta-author"><i class="fa fa-user"></i>' . esc_html(get_the_author()) . '</span>' : '';
     $output .= '<span class="post-meta-time"><i class="fa fa-calendar"></i><time datetime="' . sprintf('%s-%s-%s', get_the_date('Y'), get_the_date('m'), get_the_date('d')) . '">' . sprintf('%s %s, %s', get_the_date('F'), get_the_date('d'), get_the_date('Y')) . '</time></span>';
     $output .= comments_open() ? $number_comments == 0 ? sprintf('<span class="post-meta-comments"><i class="fa fa-comment-o"></i>' . __('No comments', 'illdy') . '</span>') : $number_comments > 1 ? sprintf('<span class="post-meta-comments"><i class="fa fa-comment-o"></i><a class="meta-comments" href="%s" title="%s ' . __('comments', 'illdy') . '">%s ' . __('comments', 'illdy') . '</a></span>', get_comments_link(), $number_comments, $number_comments) : sprintf('<span class="post-meta-comments"><i class="fa fa-comment-o"></i><a class="meta-comments" href="%s" title="' . __('1 comment', 'illdy') . '">' . __('1 comment', 'illdy') . '</a></span>', get_comments_link()) : sprintf('<span class="post-meta-comments"><i class="fa fa-comment-o"></i>' . __('Comments are off for this post', 'illdy') . '</span>');
     $output .= '</div><!--/.blog-post-meta-->';
     echo $output;
 }
Exemplo n.º 17
0
 function custom_query($atts)
 {
     extract(shortcode_atts(array('query_string' => ''), $atts));
     $result = '';
     global $post;
     $query = new wp_query($query_string);
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $meta = get_post_meta($post->ID, 'thumbnail', true);
             $result .= "<div class='post-item'>\n\t\t\t\t\t\t\t<a href=" . get_permalink() . "><img width='100' height='100' src=" . $meta . " /></a>\n\t\t\t\t\t\t\t<h1><a href=" . get_permalink() . ">" . get_the_title() . "</a></h1>\n\t\t\t\t\t\t\t<p class='metadata'><span class='post'>Posted by:</span>" . get_the_author() . "<span class='in-cat'>In:</span>" . get_the_category_list(', ') . "<span class='on-date'>On:</span>" . get_comment_time() . "<a href=" . get_comments_link() . ">" . get_comments_number('1 comment', '2 comment', '% comment') . "</a></p>\n\t\t\t\t\t\t\t<p>" . get_the_content() . "</p>\n\t\t\t\t\t\t\t<p><a class='more-link floatright' href=" . get_permalink() . ">Read More</a></p>\n\t\t\t\t\t\t</div>";
         }
     }
     return $result;
 }
Exemplo n.º 18
0
/**
 * Generate a number sensitive link to article comments
 * @since 2.0
 */
function apoc_comments_link()
{
    // Get the comment count
    $count = doubleval(get_comments_number());
    // Generate the link
    $link = '<a class="comments-link" href="' . get_comments_link() . '" title="Article Comments"><i class="fa fa-comment"></i>';
    // Context sensitive
    if ($count == 0) {
        $link .= 'Leave a Comment';
    } elseif ($count >= 1) {
        $link .= 'Comments<span class="activity-count">' . $count . '</span>';
    }
    $link .= '</a>';
    // Echo the link
    echo $link;
}
 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = esc_attr($instance['title']);
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo apply_filters('widget_title', $title, $instance, $this->id_base);
         echo $after_title;
     }
     $name = get_the_author_meta('display_name', $post->post_author);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'myThemes'), '<li>', '</li>');
     echo '<li><a href="' . get_day_link(get_post_time('Y', false, $post->ID), get_post_time('m', false, $post->ID), get_post_time('d', false, $post->ID)) . '">';
     echo '<time datetime="' . get_post_time('Y-m-d', false, $post->ID) . '"><i class="icon-calendar"></i>' . get_post_time(get_option('date_format'), false, $post->ID) . '</time></a></li>';
     echo '<li><a href="' . get_author_posts_url($post->post_author) . '" title="' . __('Writed by ', 'myThemes') . ' ' . $name . '"><i class="icon-user-5"></i>' . $name . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         if ($nr == 1) {
             $comments = $nr . ' ' . __('Comment', 'myThemes');
         } else {
             $comments = $nr . ' ' . __('Comments', 'myThemes');
         }
         echo '<li><a href="' . get_comments_link($post->ID) . '"><i class="icon-comment"></i>' . $comments . '</a></li>';
     }
     if (function_exists('stats_get_csv')) {
         $args = array('days' => -1, 'post_id' => $post->ID);
         $result = stats_get_csv('postviews', $args);
         $views = $result[0]['views'];
         $nr_views = number_format_i18n($views);
         $label_views = __('views', 'myThemes');
         if ($nr_views == 1) {
             $label_views = __('view', 'myThemes');
         }
         echo '<li><i class="icon-eye-2"></i> ' . $nr_views . ' ' . $label_views . '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = $instance['title'];
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo apply_filters('widget_title', esc_attr($title), $instance, $this->id_base);
         echo $after_title;
     }
     $y = esc_attr(get_post_time('Y', false, $post->ID));
     $m = esc_attr(get_post_time('m', false, $post->ID));
     $d = esc_attr(get_post_time('d', false, $post->ID));
     $name = get_the_author_meta('display_name', $post->post_author);
     $dtime = get_post_time('Y-m-d', false, $post->ID);
     $ptime = get_post_time(esc_attr(get_option('date_format')), false, $post->ID, true);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'treeson'), '<li>', '</li>');
     echo '<li><a href="' . esc_url(get_day_link($y, $m, $d)) . '">';
     echo '<time datetime="' . esc_attr($dtime) . '"><i class="icon-calendar"></i>' . esc_html($ptime) . '</time></a></li>';
     echo '<li><a href="' . esc_url(get_author_posts_url($post->post_author)) . '" title="' . sprintf(__('Writed by %s', 'treeson'), esc_attr($name)) . '"><i class="icon-user-5"></i>' . esc_html($name) . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         echo '<li>';
         echo '<a href="' . esc_url(get_comments_link($post->ID)) . '">';
         echo '<i class="icon-comment"></i>';
         echo sprintf(_nx('%s Comment', '%s Comments', absint($nr), 'Number of comment(s) from widget "myThemes: Meta Details"', 'treeson'), number_format_i18n(absint($nr)));
         echo '</a></li>';
     }
     if (function_exists('stats_get_csv')) {
         $args = array('days' => -1, 'post_id' => $post->ID);
         $result = stats_get_csv('postviews', $args);
         $views = $result[0]['views'];
         echo '<li><i class="icon-eye-2"></i> ' . sprintf(_n('%s view', '%s views', absint($views), 'treeson'), number_format_i18n(absint($views))) . '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
Exemplo n.º 21
0
/**
 * Gets Comments Link based on ID
 */
function pl_get_comments_link($post_id)
{
    $num_comments = get_comments_number($post_id);
    if (comments_open()) {
        if ($num_comments == 0) {
            $comments = __('Add Comment', 'pagelines');
        } elseif ($num_comments > 1) {
            $comments = $num_comments . ' ' . __('Comments', 'pagelines');
        } else {
            $comments = "1 Comment";
        }
        $write_comments = '<a href="' . get_comments_link($post_id) . '">' . $comments . '</a>';
    } else {
        $write_comments = '';
    }
    return $write_comments;
}
Exemplo n.º 22
0
function sunset_posted_footer()
{
    $comments_num = get_comments_number();
    if (comments_open()) {
        if ($comments_num == 0) {
            $comments = __('No Comments');
        } elseif ($comments_num > 1) {
            $comments = $comments_num . __(' Comments');
        } else {
            $comments = __('1 Comment');
        }
        $comments = '<a href="' . get_comments_link() . '">' . $comments . ' <span class="sunset-icon sunset-comment"></span></a>';
    } else {
        $comments = __('Comments are closed');
    }
    return '<div class="post-footer-container"><div class="row"><div class="col-xs-12 col-sm-6">' . get_the_tag_list('<div class="tags-list"><span class="sunset-icon sunset-tag"></span>', ' ', '</div>') . '</div><div class="col-xs-12 col-sm-6">' . $comments . '</div></div></div>';
}
Exemplo n.º 23
0
/**
 * Called to display post heading for news in single posts
 * @since 1.2.2
 */
function arras_postheader()
{
    global $post, $id;
    $postheader = '';
    if (is_single() || is_page()) {
        if (is_attachment()) {
            $postheader .= '<h1 class="entry-title">' . get_the_title() . ' [<a href="' . get_permalink($post->post_parent) . '" rev="attachment">' . get_the_title($post->post_parent) . '</a>]</h1>';
        } else {
            $postheader .= '<h1 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h1>';
        }
    } else {
        if (is_attachment()) {
            $postheader .= '<h2 class="entry-title">' . get_the_title() . ' [<a href="' . get_permalink($post->post_parent) . '" rev="attachment">' . get_the_title($post->post_parent) . '</a>]</h2>';
        } else {
            if (!is_page()) {
                $postheader .= '<a class="entry-comments" href="' . get_comments_link() . '">' . get_comments_number() . '</a>';
            }
            $postheader .= '<h2 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h2>';
        }
    }
    if (!is_page()) {
        $postheader .= '<div class="entry-info">';
        if (arras_get_option('post_author')) {
            $postheader .= sprintf(__('<div class="entry-author">By %s</div>', 'arras'), '<address class="author vcard"><a class="url fn n" href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . esc_attr(get_the_author()) . '">' . get_the_author() . '</a></address>');
        }
        if (arras_get_option('post_date')) {
            $postheader .= ' &ndash; <abbr class="published" title="' . get_the_time('c') . '">' . get_the_time(get_option('date_format')) . '</abbr>';
        }
        if (current_user_can('edit_post')) {
            $postheader .= '<a class="post-edit-link" href="' . get_edit_post_link($id) . '" title="' . __('Edit Post', 'arras') . '">' . __('(Edit Post)', 'arras') . '</a>';
        }
        if (!is_attachment() && arras_get_option('post_cats')) {
            $post_cats = array();
            $cats = get_the_category();
            foreach ($cats as $c) {
                $post_cats[] = '<a href="' . get_category_link($c->cat_ID) . '">' . $c->cat_name . '</a>';
            }
            $postheader .= sprintf(__('<span class="entry-cat"><strong>Posted in: </strong>%s</span>', 'arras'), implode(', ', $post_cats));
        }
        $postheader .= '</div>';
    }
    if (arras_get_option('single_thumbs') && has_post_thumbnail($post->ID)) {
        $postheader .= '<div class="entry-photo">' . arras_get_thumbnail('single-thumb') . '</div>';
    }
    echo apply_filters('arras_postheader', $postheader);
}
Exemplo n.º 24
0
/**
 * Echo post meta comments shortcode.
 *
 * @since 1.0.0
 */
function beans_post_meta_comments_shortcode()
{
    global $post;
    if (post_password_required() || !comments_open()) {
        return;
    }
    $comments_number = (int) get_comments_number($post->ID);
    if ($comments_number < 1) {
        $comment_text = beans_output('beans_post_meta_empty_comment_text', __('Leave a comment', 'tm-beans'));
    } elseif (1 === $comments_number) {
        $comment_text = beans_output('beans_post_meta_comments_text_singular', __('1 comment', 'tm-beans'));
    } else {
        $comment_text = beans_output('beans_post_meta_comments_text_plurial', __('%s comments', 'tm-beans'));
    }
    beans_open_markup_e('beans_post_meta_comments', 'a', array('href' => get_comments_link()));
    printf($comment_text, (int) get_comments_number($post->ID));
    beans_close_markup_e('beans_post_meta_comments', 'a');
}
Exemplo n.º 25
0
 function output($section_name, $config, $op, $return = false)
 {
     global $post;
     $defaults = array('before' => '', 'after' => '', 'ulclass' => '', 'post_id' => 0);
     $config = wp_parse_args($config, $defaults);
     extract($config);
     $ulclass = $ulclass == '' ? '' : ' class="' . $ulclass . '"';
     $post_id = $post_id > 0 ? $post_id : $post->ID;
     if ($post_tags = get_the_tags($post_id)) {
         $tmp_post = $post;
         $tags = array();
         foreach ($post_tags as $tag) {
             $tags[] = $tag->term_id;
         }
         $related_posts = get_posts(array('tag__in' => $tags, 'numberposts' => 4, 'exclude' => $post_id));
         $html = '';
         foreach ($related_posts as $related) {
             if ($related->ID == $post_id) {
                 continue;
             }
             $url = get_permalink($related->ID);
             $cn = get_comments_number($related->ID);
             $title = get_the_title($related->ID);
             $comments = sprintf(_n('1 Comment', '%1$s Comments', $cn, OP_SN), number_format_i18n($cn));
             $atag = ' href="' . $url . '" rel="bookmark" title="' . sprintf(esc_attr__('Permalink to %s', OP_SN), esc_attr($title)) . '"';
             $img = '';
             $class = '';
             if (has_post_thumbnail($related->ID)) {
                 $img = '<a' . $atag . ' class="thumbnail">' . get_the_post_thumbnail($related->ID, 'small-image') . '</a>';
             } else {
                 $class = ' class="no-thumbnail"';
             }
             $html .= '<li' . $class . '>' . $img . '<h4><a' . $atag . '>' . op_truncate($title) . '</a></h4><a href="' . get_comments_link($related->ID) . '">' . $comments . '</a></li>';
         }
         if (!empty($html)) {
             $html = $before . '<ul' . $ulclass . '>' . $html . '</ul>' . $after;
         }
         $post = $tmp_post;
         if ($return) {
             return $html;
         }
         echo $html;
     }
 }
Exemplo n.º 26
0
function plugin_lastcomments_widget()
{
    if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
        // no comments in cache
        $list = array();
    } else {
        // if file exists and its correctly read, we get the stored list
        // (it is stored in encoded form)
        $list = unserialize($f);
    }
    $content = '<ul class="last-comments">';
    // cimangi Aggiunta traduzione stringhe
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:lastcomments');
    if ($count = count($list)) {
        while ($arr = array_pop($list)) {
            theme_comments_filters($arr, $id);
            $q = new FPDB_Query(array('id' => $arr['entry']), null);
            // first element of the array is dropped, as it is the ID, which
            // we already know
            @(list(, $entry) = $q->getEntry($query));
            if (!$entry) {
                $count--;
                $update = true;
                continue;
            }
            $content .= "<li>\n\t\t\t<blockquote class=\"comment-quote\" cite=\"comments.php?entry={$arr['entry']}#{$arr['id']}\">\n\t\t\t{$arr['content']}\n\t\t\t<p><a href=\"" . get_comments_link($arr['entry']) . "#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>\n\t\t\t</blockquote></li>\n";
        }
        $subject = $lang['plugin']['lastcomments']['last'] . ' ' . $count . ' ' . $lang['plugin']['lastcomments']['comments'];
    }
    if (!$count) {
        if ($update) {
            fs_delete(LASTCOMMENTS_CACHE_FILE);
        }
        $content .= '<li>' . $lang['plugin']['lastcomments']['no_comments'] . '</li>';
        $subject = $lang['plugin']['lastcomments']['no_new_comments'];
    }
    $content .= '</ul>';
    $entry['subject'] = $subject;
    $entry['content'] = $content;
    return $entry;
}
Exemplo n.º 27
0
    /**
     * Prints HTML with meta information for the categories, tags and comments.
     */
    function sergeymotovilets_entry_footer($post_id)
    {
        // Hide category and tag text for pages.
        if ('post' === get_post_type()) {
            /* translators: used between list items, there is a space after the comma */
            //$tags_list = get_the_tag_list( '', esc_html__( ', ', 'sergeymotovilets' ) );
            //if ( $tags_list ) {
            //	printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'sergeymotovilets' ) . '</span>', $tags_list ); // WPCS: XSS OK.
            //}
        }
        if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
            $comments_count = wp_count_comments($post_id)->approved;
            if ($comments_count == 0) {
                $output = 'Коментариев нет';
            }
            if ($comments_count == 1) {
                $output = '1 Коментарий';
            }
            if ($comments_count > 1) {
                $output = 'Коментарии ' . $comments_count;
            }
            echo '
			<span class="comments-link"><svg><use xlink:href="#comments" /></svg>
			<a href="' . get_comments_link() . '">' . $output . '</a>
			</span>
		';
        }
        /* share */
        $current_url = home_url(add_query_arg(array(), $wp->request));
        $post_id = get_post_thumbnail_id();
        $thumb_url = wp_get_attachment_image_src($post_id, 'large', true);
        echo '
		<div class="share-link">
			<svg><use xlink:href="#share" /></svg>
			<span>Поделиться</span>
			<ul class="sub-links">
				<li class="fb-share"><a href="#" onclick="fbShare(\'' . get_the_permalink() . '\', \'' . $current_url . '\', event)">Facebook</a></li>
				<li class="vk-share"><a href="#" onclick="vkShare(\'' . get_the_permalink() . '\', \'' . get_the_title() . '\', \'' . get_the_excerpt() . '\', \'' . $thumb_url[0] . '\', event)">Вконтакте</a></li>
			</ul>
		</div>
	';
    }
Exemplo n.º 28
0
function vanilla_comments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off')
{
    global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $comments_number;
    $output = false;
    if (is_single() || is_page()) {
        return $output;
    }
    $number = get_comments_number($id);
    if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
        return '<span' . (!empty($css_class) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
    }
    if (post_password_required()) {
        return __('Enter your password to view comments');
    }
    $output .= '<a href="';
    if ($wpcommentsjavascript) {
        if (empty($wpcommentspopupfile)) {
            $home = get_option('home');
        } else {
            $home = get_option('siteurl');
        }
        $output .= $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
        $output .= '" onclick="wpopen(this.href); return false"';
    } else {
        // if comments_popup_script() is not in the template, display simple comment link
        if (0 == $number) {
            $output .= get_permalink() . '#respond';
        } else {
            $output .= get_comments_link();
        }
        $output .= '"';
    }
    if (!empty($css_class)) {
        $output .= ' class="' . $css_class . '" ';
    }
    $title = attribute_escape(get_the_title());
    $output .= apply_filters('comments_popup_link_attributes', '');
    $output .= ' title="' . sprintf(__('Comment on %s'), $title) . '">';
    comments_number($zero, $one, $more, $number);
    $output .= $comments_number . '</a>';
    return $output;
}
Exemplo n.º 29
0
function as_get_number_comment()
{
    global $post;
    $num_comments = get_comments_number();
    // get_comments_number returns only a numeric value
    $comments = '';
    $write_comments = '';
    if (comments_open()) {
        if ($num_comments == 0) {
            $comments = __('No comments', AS_DOMAIN);
        } elseif ($num_comments > 1) {
            $comments = $num_comments . __(' comments', AS_DOMAIN);
        } else {
            $comments = __('1 comment', AS_DOMAIN);
        }
        $write_comments = '<a href="' . esc_url(get_comments_link()) . '">' . $comments . '</a>';
    } else {
        $write_comments = __('Comments are off for this post.', AS_DOMAIN);
    }
    echo '<span class="dslc-icon dslc-icon-comment-alt"></span>&nbsp;' . $write_comments;
}
Exemplo n.º 30
0
function blog_shortcode($atts, $content = null, $code)
{
    global $wp_filter;
    $the_content_filter_backup = $wp_filter['the_content'];
    extract(shortcode_atts(array('max' => 3, 'meta' => ''), $atts));
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $query = array('post_type' => 'post', 'posts_per_page' => $max, 'paged' => $paged);
    query_posts($query);
    while (have_posts()) {
        the_post();
        $output .= '<div class="blog_post">';
        $output .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
        if ($meta == "true") {
            $output .= '<div class="metaInfo">Posted By ';
            $output .= get_the_author_link();
            $output .= ' / ';
            $output .= get_the_time('F, j, Y');
            $output .= ' / <a href="';
            $output .= get_comments_link();
            $output .= '">';
            $output .= get_comments_number('0', '1', '%');
            $output .= ' comments</a></div>';
        }
        if (has_post_thumbnail()) {
            $output .= '<div class="portfolio_thumbnail">';
            $thumb = get_post_thumbnail_id();
            $image = vt_resize($thumb, '', 530, 280, true, 70);
            $output .= '<a href="' . get_permalink() . '"><img src="' . $image[url] . '" width="' . $image[width] . '" height="' . $image[height] . '" alt="' . $lbtitle . '" /></a>';
            $output .= '</div>';
        }
        $output .= apply_filters('the_content', get_the_content());
        $output .= '</div>';
    }
    ob_start();
    wp_pagenavi();
    $output .= ob_get_clean();
    wp_reset_query();
    $wp_filter['the_content'] = $the_content_filter_backup;
    return $output;
}