Esempio n. 1
0
                  </header>
                  <div class="post-info">
                    <?php 
                            if ($mts_options['mts_date_show'] == '1') {
                                ?>
<span class="thetime updated"><span itemprop="datePublished"> <?php 
                                the_time(get_option('date_format'));
                                ?>
</span></span><?php 
                            }
                            ?>
                    <?php 
                            if ($mts_options['mts_minutes_to_read'] == '1') {
                                ?>
<span class="mts-minutes-to-read"><?php 
                                echo mts_minutes_to_read();
                                ?>
</span><?php 
                            }
                            ?>
                  </div>
                </article> <!--Latest-Posts-article-1-->
              <?php 
                            $j++;
                        }
                    }
                    wp_reset_postdata();
                    ?>
            </div>
          <?php 
                } elseif ($category_id != 'latest' && $featured_category_layout == 'column_1') {
Esempio n. 2
0
    function mts_related_posts()
    {
        global $post;
        $mts_options = get_option(MTS_THEME_NAME);
        //if(!empty($mts_options['mts_related_posts'])) {
        ?>
	
    		<!-- Start Related Posts -->
    		<?php 
        $empty_taxonomy = false;
        if (empty($mts_options['mts_related_posts_taxonomy']) || $mts_options['mts_related_posts_taxonomy'] == 'tags') {
            // related posts based on tags
            $tags = get_the_tags($post->ID);
            if (empty($tags)) {
                $empty_taxonomy = true;
            } else {
                $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' => $mts_options['mts_related_postsnum'], 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
            }
        } else {
            // related posts based on categories
            $categories = get_the_category($post->ID);
            if (empty($categories)) {
                $empty_taxonomy = true;
            } else {
                $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' => $mts_options['mts_related_postsnum'], 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
            }
        }
        if (!$empty_taxonomy) {
            $my_query = new wp_query($args);
            if ($my_query->have_posts()) {
                echo '<h4 class="single-page-title related-posts-title">' . __('Related Posts', 'mythemeshop') . '</h4>';
                echo '<div class="related-posts most-popular-posts">';
                echo '<div class="clear">';
                $posts_per_row = 3;
                $j = 0;
                while ($my_query->have_posts()) {
                    $my_query->the_post();
                    ?>
                 <article class="latestPost excerpt  <?php 
                    echo ++$j % $posts_per_row == 0 ? 'last' : '';
                    ?>
">
                    <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
" class="post-image post-image-left">
                       <div class="featured-thumbnail">
                            <?php 
                    the_post_thumbnail('featured2', array('class' => 'attachment-featured wp-post-image'));
                    ?>
 
                            <div class="most-popular-hover"> 
                                <header>
                                    <h3 class="title front-view-title" itemprop="headline"><?php 
                    the_title();
                    ?>
</h3>
                                </header>
                                <div class="front-view-content"> <?php 
                    echo mts_excerpt(10);
                    ?>
</div>
                           </div>
                        </div>
             
                        <div class="post-info">
                            <div class="thetime updated"><div itemprop="datePublished"><?php 
                    the_time(get_option('date_format'));
                    ?>
</div></div>
                            <div class="thecomment"><?php 
                    if ($mts_options['mts_minutes_to_read'] == '1') {
                        ?>
<span class="mts-minutes-to-read"><?php 
                        echo mts_minutes_to_read();
                        ?>
</span><?php 
                    }
                    ?>
</div>
                        </div>
                    </a>
                </article> <!--Most-Popular-article-4-->
    			<?php 
                }
                echo '</div></div>';
            }
        }
        wp_reset_query();
        ?>
    		<!-- .related-posts -->
    	<?php 
    }