Пример #1
0
				<li id="featured-post-<?php 
                    the_ID();
                    ?>
">

					<!--BEGIN .featured-image -->
					<div class="featured-image clearfix">

						<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    dt_image(260, '');
                    ?>
</a>

					<!--END .featured-image -->
					</div>

				<!--END li-->
				</li>

				<?php 
                }
            } else {
                ?>
					<p><?php 
                _e('There are no related projects right now.', 'engine');
Пример #2
0
    function widget($args, $instance)
    {
        /*Backup query string for later use*/
        global $query_string;
        $backup_query_string = $query_string;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        if (empty($title)) {
            $title = false;
        }
        $related_type = $instance['related_type'];
        $description = $instance['description'];
        $thumbnail = $instance['thumbnail'] == 1 ? true : false;
        $posttitle = $instance['posttitle'] == 1 ? true : false;
        $byline = $instance['byline'] == 1 ? true : false;
        $excerpt = $instance['excerpt'] == 1 ? true : false;
        $meta = $instance['meta'] == 1 ? true : false;
        $number = intval($instance['number']);
        global $wp_query;
        global $post;
        $curr_id = $post->ID;
        if (!is_single()) {
            return;
        }
        echo $before_widget;
        if ($title) {
            echo $before_title;
            echo $title;
            echo $after_title;
        }
        if ($description != "") {
            echo '<p>' . stripslashes($description) . '</p>';
        }
        $count = 0;
        if ($related_type == "category") {
            $categories = get_the_category();
            $catlist = array();
            foreach ($categories as $category) {
                $catlist[] = $category->cat_ID;
            }
            $args = array('posts_per_page' => $number, 'category__in' => $catlist, 'post__not_in' => array($curr_id));
            $related_query = new WP_Query($args);
            if ($related_query->have_posts()) {
                echo '<ul>';
                while ($related_query->have_posts()) {
                    $related_query->the_post();
                    ?>
			<li class="cf">

			<?php 
                    if ($thumbnail) {
                        ?>
				<a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><?php 
                        dt_image(60, 60);
                        ?>
</a>
			<?php 
                    }
                    ?>

			<?php 
                    if ($posttitle) {
                        ?>
				<h2><a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h2>
			<?php 
                    }
                    ?>

			<?php 
                    if ($byline) {
                        ?>
			<!--BEGIN .post-meta .post-header-->
			<div class="post-meta post-header">
			
				<span class="meta-author"><?php 
                        _e('Posted by', 'engine');
                        ?>
 <?php 
                        the_author_posts_link();
                        ?>
</span>
				<span class="meta-published"><?php 
                        _e('on', 'engine');
                        ?>
 <?php 
                        the_time(get_option('date_format'));
                        ?>
</span>																
				
			<!--END .post-meta post-header -->
			</div>
			<?php 
                    }
                    ?>


			<?php 
                    if ($excerpt) {
                        ?>
				<?php 
                        dt_excerpt(25);
                        ?>
			<?php 
                    }
                    ?>

			<?php 
                    if ($meta) {
                        ?>
			<!--BEGIN .post-meta .post-footer-->
			<div class="post-meta post-footer">
			
				<span class="meta-categories"><?php 
                        _e('Posted in', 'engine');
                        ?>
 <?php 
                        the_category(', ');
                        ?>
</span>
                <span class="meta-comment"><?php 
                        comments_popup_link(__('No Comments', 'engine'), __('1 Comment', 'engine'), __('% Comments', 'engine'));
                        ?>
 </span>
                
			<!--END .post-meta .post-footer-->
			</div>
			<?php 
                    }
                    ?>

			</li>

<?php 
                }
                echo '</ul>';
            }
            ##END CATEGORIES##
        } elseif ($related_type == "tags") {
            $tags = get_the_tags();
            if (!$tags) {
                echo '<p>No related posts</p>';
                echo $after_widget;
                return;
            }
            $taglist = array();
            foreach ($tags as $tag) {
                $taglist[] = $tag->term_id;
            }
            $args = array('posts_per_page' => $number, 'tag__in' => $taglist, 'post__not_in' => array($curr_id));
            $related_query = new WP_Query($args);
            if ($related_query->have_posts()) {
                echo '<ul>';
                while ($related_query->have_posts()) {
                    $related_query->the_post();
                    ?>

			<li class="cf">

			<?php 
                    if ($thumbnail) {
                        ?>
				<?php 
                        dt_image(60, 60);
                        ?>
			<?php 
                    }
                    ?>

			<?php 
                    if ($posttitle) {
                        ?>
				<h2><a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h2>
			<?php 
                    }
                    ?>

			<?php 
                    if ($byline) {
                        ?>
			<!--BEGIN .post-meta .post-header-->
			<div class="post-meta post-header">
			
				<span class="meta-author"><?php 
                        _e('Posted by', 'engine');
                        ?>
 <?php 
                        the_author_posts_link();
                        ?>
</span>
				<span class="meta-published"><?php 
                        _e('on', 'engine');
                        ?>
 <?php 
                        the_time(get_option('date_format'));
                        ?>
</span>																
				
			<!--END .post-meta post-header -->
			</div>
			<?php 
                    }
                    ?>

			<?php 
                    if ($excerpt) {
                        ?>
				<?php 
                        dt_excerpt('25');
                        ?>
			<?php 
                    }
                    ?>

			<?php 
                    if ($meta) {
                        ?>
			<!--BEGIN .post-meta .post-footer-->
			<div class="post-meta post-footer">
			
				<span class="meta-categories"><?php 
                        _e('Posted in', 'engine');
                        ?>
 <?php 
                        the_category(', ');
                        ?>
</span>
                <span class="meta-comment"><?php 
                        comments_popup_link(__('No Comments', 'engine'), __('1 Comment', 'engine'), __('% Comments', 'engine'));
                        ?>
 </span>
                
			<!--END .post-meta .post-footer-->
			</div>
			<?php 
                    }
                    ?>

			</li>


<?php 
                }
                echo '</ul>';
            }
            ##END TAGS##
        } else {
            $the_author = $wp_query->post->post_author;
            $args = array('posts_per_page' => $number, 'author' => $the_author, 'post__not_in' => array($curr_id));
            $related_query = new WP_Query($args);
            if ($related_query->have_posts()) {
                echo '<ul>';
                while ($related_query->have_posts()) {
                    $related_query->the_post();
                    ?>
			<li class="cf">

			<?php 
                    if ($thumbnail) {
                        ?>
				<?php 
                        dt_image(60, 60);
                        ?>
			<?php 
                    }
                    ?>

			<?php 
                    if ($posttitle) {
                        ?>
				<h2><a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h2>
			<?php 
                    }
                    ?>

			<?php 
                    if ($byline) {
                        ?>
			<!--BEGIN .post-meta .post-header-->
			<div class="post-meta post-header">
			
				<span class="meta-author"><?php 
                        _e('Posted by', 'engine');
                        ?>
 <?php 
                        the_author_posts_link();
                        ?>
</span>
				<span class="meta-published"><?php 
                        _e('on', 'engine');
                        ?>
 <?php 
                        the_time(get_option('date_format'));
                        ?>
</span>																
				
			<!--END .post-meta post-header -->
			</div>

			<?php 
                    }
                    ?>

			<?php 
                    if ($excerpt) {
                        ?>
				<?php 
                        dt_excerpt('25');
                        ?>
			<?php 
                    }
                    ?>

			<?php 
                    if ($meta) {
                        ?>
			<!--BEGIN .post-meta .post-footer-->
			<div class="post-meta post-footer">
			
				<span class="meta-categories"><?php 
                        _e('Posted in', 'engine');
                        ?>
 <?php 
                        the_category(', ');
                        ?>
</span>
                <span class="meta-comment"><?php 
                        comments_popup_link(__('No Comments', 'engine'), __('1 Comment', 'engine'), __('% Comments', 'engine'));
                        ?>
 </span>
                
			<!--END .post-meta .post-footer-->
			</div>
			<?php 
                    }
                    ?>

			</li>

<?php 
                }
                echo '</ul>';
            }
        }
        ##END AUTHOR##
        echo $after_widget;
        /*Reset query to initial*/
        query_posts($backup_query_string);
        the_post();
    }
Пример #3
0
        the_ID();
        ?>
">

					<!--BEGIN .featured-image -->
					<div class="featured-image">

						<?php 
        dt_overlay_icon();
        ?>
						
						<a href="<?php 
        the_permalink();
        ?>
"><?php 
        dt_image(300, 180);
        ?>
</a>
						
					<!--END .featured-image -->
					</div>
					
					<?php 
        $format = get_post_format();
        ?>
					
					<span class="meta-category icon-<?php 
        echo $format;
        ?>
"><?php 
        the_category(', ');
Пример #4
0
					<!--BEGIN .featured-image -->
					<div class="featured-image">

						<?php 
        dt_overlay_icon();
        ?>
						
						<?php 
        if (has_post_thumbnail()) {
            ?>
							<a href="<?php 
            the_permalink();
            ?>
"><?php 
            dt_image(300, '');
            ?>
</a>
						<?php 
        }
        ?>
						
					<!--END .featured-image -->
					</div>
					
					<?php 
        $format = get_post_format();
        ?>
					
					<h2 class="post-title"><a href="<?php 
        the_permalink();
Пример #5
0
				</div>

				<!--BEGIN .featured-image -->
				<div class="featured-image">

					<?php 
        if (has_post_thumbnail()) {
            ?>
						<?php 
            dt_overlay_icon(true);
            ?>
						<a href="<?php 
            the_permalink();
            ?>
"><?php 
            dt_image(400, 390);
            ?>
</a>
					<?php 
        }
        ?>

				<!--END .featured-image -->
				</div>

			<!--END .hentry-->
			</div>

			<?php 
    }
}
Пример #6
0
    function widget($args, $instance)
    {
        /*Backup query string for later use*/
        global $query_string;
        $backup_query_string = $query_string;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        if (empty($title)) {
            $title = false;
        }
        $posttype = $instance['posttype'];
        $sort_by = $instance['sort_by'];
        $description = $instance['description'];
        $thumbnail = $instance['thumbnail'] == 1 ? true : false;
        $posttitle = $instance['posttitle'] == 1 ? true : false;
        $byline = $instance['byline'] == 1 ? true : false;
        $excerpt = $instance['excerpt'] == 1 ? true : false;
        $meta = $instance['meta'] == 1 ? true : false;
        //Check if displaying only thumbs
        if ($thumbnail == true && $posttitle == false && $byline == false && $excerpt == false && $meta == false) {
            $onlythumbs = 'onlythumbs';
        }
        $number = absint($instance['number']);
        $categories = (array) $instance['categories'];
        $tags = (array) $instance['tags'];
        $author = intval($instance['author']);
        echo $before_widget;
        if ($title) {
            echo $before_title;
            echo $title;
            echo $after_title;
        }
        if ($description != "") {
            echo '<p class="description">' . stripslashes($description) . '</p>';
        }
        $args = array();
        //Number
        $args['posts_per_page'] = $number;
        //Post type
        if ($posttype == "categories") {
            $args['category__in'] = $categories;
        } elseif ($posttype == "tags") {
            $args['tag__in'] = $tags;
        } elseif ($posttype == "author") {
            $args['author'] = $author;
        }
        //Order by
        if ($sort_by == "popular") {
            $args['orderby'] = "comment_count";
        } elseif ($sort_by == "random") {
            $args['orderby'] = "rand";
        } else {
            $args['orderby'] = "date";
        }
        $get_posts_query = new WP_Query($args);
        if ($get_posts_query->have_posts()) {
            echo '<ul class="cf">';
            while ($get_posts_query->have_posts()) {
                $get_posts_query->the_post();
                ################################
                #  DISPLAY POST CONTENT START  #
                ################################
                ?>

			<li class="cf">

			<?php 
                if ($thumbnail) {
                    ?>
				<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    dt_image(60, 60);
                    ?>
</a>
			<?php 
                }
                ?>

			<?php 
                if ($posttitle) {
                    ?>
				<h2 class="post-title"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h2>
			<?php 
                }
                ?>

			<?php 
                if ($byline) {
                    ?>
			<!--BEGIN .post-meta .post-header-->
			<div class="post-meta post-header">
			
				<span class="meta-author"><?php 
                    _e('Posted by', 'engine');
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
</span>
				<span class="meta-published"><?php 
                    _e('on', 'engine');
                    ?>
 <?php 
                    the_time(get_option('date_format'));
                    ?>
</span>																
				
			<!--END .post-meta post-header -->
			</div>
			<?php 
                }
                ?>

			<?php 
                if ($excerpt) {
                    ?>
				<?php 
                    dt_excerpt(25);
                    ?>
			<?php 
                }
                ?>

			<?php 
                if ($meta) {
                    ?>
			<!--BEGIN .post-meta .post-footer-->
			<div class="post-meta post-footer">
			
				<span class="meta-categories"><?php 
                    _e('Posted in', 'engine');
                    ?>
 <?php 
                    the_category(', ');
                    ?>
</span>
                <span class="meta-comment"><?php 
                    comments_popup_link(__('No Comments', 'engine'), __('1 Comment', 'engine'), __('% Comments', 'engine'));
                    ?>
 </span>
                
			<!--END .post-meta .post-footer-->
			</div>
			<?php 
                }
                ?>

			</li>

<?php 
                ###############################
                #   DISPLAY POST CONTENT END  #
                ###############################
            }
            echo '</ul>';
        }
        echo $after_widget;
        /*Reset query to initial*/
        query_posts($backup_query_string);
        the_post();
    }