示例#1
0
    public function get_popular_posts($qty, $comment_num, $date, $days, $show_thumb, $show_excerpt, $excerpt_length)
    {
        global $post;
        $popular_days = array();
        if ($days) {
            $popular_days = array('after' => "{$days} day ago", 'before' => 'today', 'inclusive' => true);
        }
        $popular = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days));
        echo '<div class="recent-posts-wrap"><ul>';
        foreach ($popular as $post) {
            setup_postdata($post);
            ?>
			<?php 
            echo '<li class="post-box horizontal-container">';
            ?>
				<?php 
            if ($show_thumb == 1) {
                ?>
				<div class="widget-post-img">
					<a rel="nofollow" href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
					<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('tiny');
                    ?>
					</a>
					<?php 
                } else {
                    ?>
					<a rel="nofollow" href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><img src="<?php 
                    echo get_template_directory_uri();
                    ?>
/images/nothumb-80x80.png" width="80" height="80" alt="<?php 
                    the_title_attribute();
                    ?>
" /></a>
					<?php 
                }
                ?>
				</div>
				<?php 
            }
            ?>
					<div class="widget-post-data">
						<div class="widget-post-title">
							<a rel="nofollow" href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
						</div>
						<?php 
            if ($date == 1 || $comment_num == 1) {
                ?>
						<div class="post-info widget-post-info">
							<?php 
                if ($date == 1) {
                    redwaves_posted();
                }
                ?>
							<?php 
                if ($comment_num == 1) {
                    redwaves_entry_comments();
                }
                ?>
						</div> <!--end .post-info-->
						<?php 
            }
            ?>
						<?php 
            if ($show_excerpt == 1) {
                ?>
						<div class="widget-post-excerpt">
							<?php 
                echo redwaves_excerpt($excerpt_length);
                ?>
						</div>
						<?php 
            }
            ?>
				</div>
		<?php 
        }
        wp_reset_postdata();
        echo '</ul></div>' . "\r\n";
    }
示例#2
0
    function redwaves_related_posts()
    {
        $related_posts = get_theme_mod('related_posts', '1');
        $related_posts_number = get_theme_mod('related_posts_number', '4');
        $related_posts_query = get_theme_mod('related_posts_query', 'tags');
        if ($related_posts && intval($related_posts_number) > 0 && intval($related_posts_number) <= 6) {
            if ($related_posts_query && $related_posts_query === 'tags') {
                global $post;
                $orig_post = $post;
                $tags = wp_get_post_tags($post->ID);
                if ($tags) {
                    $tag_ids = array();
                    foreach ($tags as $individual_tag) {
                        $tag_ids[] = $individual_tag->term_id;
                    }
                    $args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $related_posts_number, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
                    $my_query = new wp_query($args);
                    if ($my_query->have_posts()) {
                        echo '<div id="related_posts" class="related-posts"><h3>' . esc_attr_e('Related Posts', 'redwaves-lite') . '</h3><ul>';
                        while ($my_query->have_posts()) {
                            $my_query->the_post();
                            ?>
				<?php 
                            if (has_post_thumbnail()) {
                                ?>
				<li><div class="horizontal-container"><div class="relatedthumb"><a href="<?php 
                                the_permalink();
                                ?>
" rel="bookmark" title="<?php 
                                the_title_attribute();
                                ?>
"><?php 
                                the_post_thumbnail('small');
                                ?>
</a></div>
				<div class="post-data-container"><div class="post-title"><?php 
                                the_title();
                                ?>
</div><div class="post-info"><div class="meta-info">
				<?php 
                                redwaves_posted();
                                redwaves_entry_comments();
                                ?>
				</div></div></div></div></li>
				<?php 
                            } else {
                                ?>
				<li><div class="horizontal-container">
				<div class="relatedthumb">
				<a href="<?php 
                                the_permalink();
                                ?>
" rel="bookmark" title="<?php 
                                the_title_attribute();
                                ?>
">
				<img src="<?php 
                                echo get_template_directory_uri();
                                ?>
/images/nothumb-120x120.png" width="120" height="120" alt="<?php 
                                the_title_attribute();
                                ?>
" />
				</a>
				</div>
				<div class="post-data"><div class="post-data-container">
				<div class="post-title"><?php 
                                the_title();
                                ?>
</div>
				<div class="post-info"><div class="meta-info">
				<?php 
                                redwaves_posted();
                                redwaves_entry_comments();
                                ?>
				</div></div>
				</div></div>
				</div></li>
				<?php 
                            }
                            ?>
				<?php 
                        }
                        echo '</ul></div>';
                    }
                }
                $post = $orig_post;
                wp_reset_query();
            } else {
                global $post;
                $orig_post = $post;
                $categories = get_the_category($post->ID);
                if ($categories) {
                    $category_ids = array();
                    foreach ($categories as $individual_category) {
                        $category_ids[] = $individual_category->term_id;
                    }
                    $args = array('category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $related_posts_number, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
                    $my_query = new wp_query($args);
                    if ($my_query->have_posts()) {
                        echo '<div id="related_posts" class="related-posts"><h3>Related Posts</h3><ul>';
                        while ($my_query->have_posts()) {
                            $my_query->the_post();
                            ?>
				<?php 
                            if (has_post_thumbnail()) {
                                ?>
				<li><div class="horizontal-container"><div class="relatedthumb"><a href="<?php 
                                the_permalink();
                                ?>
" rel="bookmark" title="<?php 
                                the_title_attribute();
                                ?>
"><?php 
                                the_post_thumbnail('small');
                                ?>
</a></div>
				<div class="post-data-container"><div class="post-title"><?php 
                                the_title();
                                ?>
</div><div class="post-info"><div class="meta-info">
				<?php 
                                redwaves_posted();
                                redwaves_entry_comments();
                                ?>
				</div></div></div></div></li>
				<?php 
                            } else {
                                ?>
				<li><div class="horizontal-container">
				<div class="relatedthumb">
				<a href="<?php 
                                the_permalink();
                                ?>
" rel="bookmark" title="<?php 
                                the_title_attribute();
                                ?>
">
				<img src="<?php 
                                echo get_template_directory_uri();
                                ?>
/images/nothumb-120x120.png" width="120" height="120" alt="<?php 
                                the_title_attribute();
                                ?>
" />
				</a>
				</div>
				<div class="post-data"><div class="post-data-container">
				<div class="post-title"><?php 
                                the_title();
                                ?>
</div>
				<div class="post-info"><div class="meta-info">
				<?php 
                                redwaves_posted();
                                redwaves_entry_comments();
                                ?>
				</div></div>
				</div></div>
				</div></li>
				<?php 
                            }
                            ?>
				<?php 
                        }
                        echo '</ul></div>';
                    }
                }
                $post = $orig_post;
                wp_reset_query();
            }
        }
    }
示例#3
0
    function redwaves_related_posts()
    {
        $related_posts = get_theme_mod('related_posts', '1');
        $related_posts_number = get_theme_mod('related_posts_number', '4');
        $related_posts_query = get_theme_mod('related_posts_query', 'tags');
        $related_posts_excerpt = get_theme_mod('related_posts_excerpt', '10');
        if ($related_posts == true && intval($related_posts_number) > 0 && intval($related_posts_number) <= 6) {
            if ($related_posts_query && $related_posts_query == 'tags') {
                // Query type: Tags
                global $post;
                $orig_post = $post;
                $tags = wp_get_post_tags($post->ID);
                if ($tags) {
                    $tag_ids = array();
                    foreach ($tags as $individual_tag) {
                        $tag_ids[] = $individual_tag->term_id;
                    }
                    $args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $related_posts_number, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
                    $my_query = new wp_query($args);
                    if ($my_query->have_posts()) {
                        ?>
							<div id="related_posts" class="related-posts"><h3><?php 
                        _e("Related Posts", "redwaves-lite");
                        ?>
</h3><ul>
							<?php 
                        while ($my_query->have_posts()) {
                            $my_query->the_post();
                            ?>
							<li>
								<div class="horizontal-container">
									<div class="relatedthumb">
										<a href="<?php 
                            the_permalink();
                            ?>
" title="<?php 
                            the_title_attribute();
                            ?>
">
											<img width="120" height="120" src="<?php 
                            echo redwaves_get_thumbnail('small');
                            ?>
" class="attachment-featured wp-post-image" alt="<?php 
                            the_title_attribute();
                            ?>
">
											<div class="post-format"><i class="fa fa-file-text"></i></div>
										</a>
									</div>
									<div class="post-data-container">
										<div class="post-title">
											<h4><a href="<?php 
                            the_permalink();
                            ?>
" title="<?php 
                            the_title_attribute();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></h4>
										</div>
										<div class="post-info">
											<div class="meta-info">
												<?php 
                            redwaves_posted();
                            redwaves_entry_comments();
                            ?>
											</div>
										</div>
										<div class="widget-post-excerpt">
											<?php 
                            if ($related_posts_excerpt && intval($related_posts_excerpt) > 0 && intval($related_posts_excerpt) <= 40) {
                                echo redwaves_excerpt($related_posts_excerpt);
                            }
                            ?>
										</div>
									</div>
								</div>
							</li>
							<?php 
                        }
                        echo '</ul></div>';
                    }
                }
                $post = $orig_post;
                wp_reset_query();
            } else {
                // Query type: Categories
                global $post;
                $orig_post = $post;
                $categories = get_the_category($post->ID);
                if ($categories) {
                    $category_ids = array();
                    foreach ($categories as $individual_category) {
                        $category_ids[] = $individual_category->term_id;
                    }
                    $args = array('category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $related_posts_number, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
                    $my_query = new wp_query($args);
                    if ($my_query->have_posts()) {
                        ?>
							<div id="related_posts" class="related-posts"><h3><?php 
                        _e("Related Posts", "redwaves-lite");
                        ?>
</h3><ul>
							<?php 
                        while ($my_query->have_posts()) {
                            $my_query->the_post();
                            ?>
							<li>
								<div class="horizontal-container">
									<div class="relatedthumb">
										<a href="<?php 
                            the_permalink();
                            ?>
" title="<?php 
                            the_title_attribute();
                            ?>
">
											<img width="120" height="120" src="<?php 
                            echo redwaves_get_thumbnail('small');
                            ?>
" class="attachment-featured wp-post-image" alt="<?php 
                            the_title_attribute();
                            ?>
">
											<div class="post-format"><i class="fa fa-file-text"></i></div>
										</a>
									</div>
									<div class="post-data-container">
										<div class="post-title">
											<h4><a href="<?php 
                            the_permalink();
                            ?>
" title="<?php 
                            the_title_attribute();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></h4>
										</div>
										<div class="post-info">
											<div class="meta-info">
												<?php 
                            redwaves_posted();
                            redwaves_entry_comments();
                            ?>
											</div>
										</div>
										<div class="widget-post-excerpt">
											<?php 
                            if ($related_posts_excerpt && intval($related_posts_excerpt) > 0 && intval($related_posts_excerpt) <= 40) {
                                echo redwaves_excerpt($related_posts_excerpt);
                            }
                            ?>
										</div>
									</div>
								</div>
							</li>
							<?php 
                        }
                        echo '</ul></div>';
                    }
                }
                $post = $orig_post;
                wp_reset_query();
            }
        }
    }
示例#4
0
    the_title_attribute();
    ?>
">
						<div class="post-format"><i class="fa fa-file-text"></i></div>
					</a>
				</div>
				<header class="entry-header">
					<div class="entry-meta post-info">
						<?php 
    the_title(sprintf('<h2 class="entry-title post-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
    $archives_post_meta = get_theme_mod('archives_post_meta', '1');
    if ($archives_post_meta) {
        redwaves_entry_category();
        redwaves_entry_author();
        redwaves_posted();
        redwaves_entry_comments();
        ?>
						<?php 
    }
    ?>
	             
					</div><!-- .entry-meta -->
				</header><!-- .entry-header -->
				<div class="entry-content post-excerpt">
					<?php 
    archives_excerpt();
    ?>
				</div><!-- .entry-content -->
				<div class="readmore">
					<a href="<?php 
    echo get_permalink();
    public function get_cat_posts($qty, $comment_num, $date, $show_thumb, $show_excerpt, $excerpt_length)
    {
        // Custom CSS Output
        if ($show_thumb == 1) {
            $css = 'padding-left:90px;';
        } else {
            $css = 'padding-left:10px;';
        }
        global $post;
        $posts = new WP_Query("orderby=date&order=DESC&posts_per_page=" . ($qty - 1));
        echo '<div class="widget-container recent-posts-wrap"><ul>';
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
			<?php 
            echo '<li class="post-box horizontal-container" style="' . $css . '">';
            ?>
				<?php 
            if ($show_thumb == 1) {
                ?>
				<div class="widget-post-img">
					<a rel="nofollow" href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
						<img width="70" height="70" src="<?php 
                echo redwaves_get_thumbnail('tiny');
                ?>
" class="attachment-featured wp-post-image" alt="<?php 
                the_title_attribute();
                ?>
">				
						<div class="post-format"><i class="fa fa-file-text"></i></div>
					</a>
				</div>
				<?php 
            }
            ?>
				
					<div class="widget-post-data">
						<h4><a rel="nofollow" href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
						<?php 
            if ($date == 1 || $comment_num == 1) {
                ?>
							<div class="widget-post-info">
								<?php 
                if ($date == 1) {
                    redwaves_posted();
                }
                ?>
								<?php 
                if ($comment_num == 1) {
                    redwaves_entry_comments();
                }
                ?>
                                                     
							</div><!--end .widget-post-info-->
						<?php 
            }
            ?>
						<?php 
            if ($show_excerpt == 1) {
                ?>
							<div class="widget-post-excerpt">
								<?php 
                echo redwaves_excerpt($excerpt_length);
                ?>
							</div>
						<?php 
            }
            ?>
					</div>
			<?php 
            echo '</li>';
            ?>
		<?php 
        }
        wp_reset_postdata();
        echo '</ul></div>' . "\r\n";
    }
    public function get_popular_posts($qty, $comment_num, $date, $days, $show_thumb, $show_excerpt, $excerpt_length)
    {
        // Custom CSS Output
        if ($show_thumb == 1) {
            $css = 'padding-left:90px;';
        } else {
            $css = 'padding-left:10px;';
        }
        global $post;
        $popular_days = array();
        if ($days) {
            $popular_days = array('after' => "{$days} day ago", 'before' => 'today', 'inclusive' => true);
        }
        $popular = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days));
        echo '<div class="widget-container recent-posts-wrap"><ul>';
        foreach ($popular as $post) {
            setup_postdata($post);
            ?>
			<?php 
            echo '<li class="post-box horizontal-container" style="' . $css . '">';
            ?>
				<?php 
            if ($show_thumb == 1) {
                ?>
				<div class="widget-post-img">
					<a rel="nofollow" href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
						<img width="70" height="70" src="<?php 
                echo redwaves_get_thumbnail('tiny');
                ?>
" class="attachment-featured wp-post-image" alt="<?php 
                the_title_attribute();
                ?>
">				
						<div class="post-format"><i class="fa fa-file-text"></i></div>
					</a>
				</div>
				<?php 
            }
            ?>
					<div class="widget-post-data">
						<h4><a rel="nofollow" href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
						<?php 
            if ($date == 1 || $comment_num == 1) {
                ?>
							<div class="widget-post-info">
								<?php 
                if ($date == 1) {
                    redwaves_posted();
                }
                ?>
								<?php 
                if ($comment_num == 1) {
                    redwaves_entry_comments();
                }
                ?>
							</div> <!--end .post-info-->
						<?php 
            }
            ?>
						<?php 
            if ($show_excerpt == 1) {
                ?>
							<div class="widget-post-excerpt">
								<?php 
                echo redwaves_excerpt($excerpt_length);
                ?>
							</div>
						<?php 
            }
            ?>
					</div>
			<?php 
        }
        wp_reset_postdata();
        echo '</ul></div>' . "\r\n";
    }
示例#7
0
    public function get_cat_posts($qty, $comment_num, $date, $show_thumb, $show_excerpt, $excerpt_length)
    {
        $posts = new WP_Query("orderby=date&order=DESC&posts_per_page=" . ($qty - 1));
        echo '<div class="recent-posts-wrap"><ul>';
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
			<?php 
            echo '<li class="post-box horizontal-container">';
            ?>
				<?php 
            if ($show_thumb == 1) {
                ?>
				<div class="widget-post-img">
					<a rel="nofollow" href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
					<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('tiny');
                    ?>
					</a>
					<?php 
                } else {
                    ?>
					<a rel="nofollow" href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><img src="<?php 
                    echo get_template_directory_uri();
                    ?>
/images/nothumb-80x80.png" width="80" height="80" alt="<?php 
                    the_title_attribute();
                    ?>
" /></a>
					<?php 
                }
                ?>
				</div>
				<?php 
            }
            ?>
				
					<div class="widget-post-data">
						<div class="widget-post-title">
							<a rel="nofollow" href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
						</div>
						<?php 
            if ($date == 1 || $comment_num == 1) {
                ?>
						<div class="post-info widget-post-info">
							<?php 
                if ($date == 1) {
                    redwaves_posted();
                }
                ?>
							<?php 
                if ($comment_num == 1) {
                    redwaves_entry_comments();
                }
                ?>
                                                     
						</div><!--.post-info-->
						<?php 
            }
            ?>
						<?php 
            if ($show_excerpt == 1) {
                ?>
						<div class="widget-post-excerpt">
							<?php 
                echo redwaves_excerpt($excerpt_length);
                ?>
						</div>
						<?php 
            }
            ?>
					</div>

			<?php 
            echo '</li>';
            ?>
		<?php 
        }
        echo '</ul></div>' . "\r\n";
    }