コード例 #1
0
    function block($instance)
    {
        extract($instance);
        $title = $instance['title'];
        $post_type = 'all';
        $categories = $instance['categories'];
        $post_types = get_post_types();
        unset($post_types['page'], $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item']);
        if ($post_type == 'all') {
            $post_type_array = $post_types;
        } else {
            $post_type_array = $post_type;
        }
        ?>
			<?php 
        if ($title == "") {
        } else {
            ?>
			<h2 class="widget"><a href="<?php 
            echo get_category_link($categories);
            ?>
"><?php 
            echo esc_attr($title);
            ?>
</a></h2>
			<?php 
        }
        ?>
            </div></div></div>
            
            
            <div class="clearfix"></div>
            <div class="maso <?php 
        if ($offset == 1) {
            echo 'nav-offset';
        } else {
        }
        ?>
 <?php 
        if ($right_lay == 1) {
            echo 'right-layout';
        } else {
        }
        ?>
">
            
                <ul class="maso-inn" >
                
                
                    <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso1 item">
                                
                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('horiz', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_cat();
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>
                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
                    



                    <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'offset' => 1, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso2 item">


                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('horiz', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_cat();
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>

                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
                    
                    
                
                    <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'offset' => 2, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso3 masosmall item">


                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('small', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>

                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
                    
                    
                    <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'offset' => 3, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso4 masosmall item">


                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('small', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>

                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
    
                    
                    
                     <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'offset' => 4, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso5 masosmall item">


                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('small', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>

                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
                    



                     <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'offset' => 5, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso6 masosmall item">


                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('vert', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>

                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
                    
                    
                    
                    
                     <?php 
        $recent_posts = new WP_Query(array('showposts' => 1, 'cat' => $categories, 'offset' => 6, 'ignore_sticky_posts' => 1));
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            ?>
        
                        <li class="maso7 masosmall item">


                                <div class="imgwrap">
                            
                                    <?php 
            echo tmnf_ratings();
            ?>
                                
                                     <a class="imglink" href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" >
                                     
                                        <?php 
            the_post_thumbnail('vert', array('class' => "tranz grayscale grayscale-fade"));
            ?>
                                        
                                     </a>
                                     
                                </div>
                                
                                <div class="masoinside tranz"><span class="bg tranz"></span>
                                
									<?php 
            tmnf_meta_date();
            tmnf_meta_counter();
            ?>
                                    
                                    <div class="clearfix"></div>
                                        
                                    <h2><a href="<?php 
            tmnf_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            echo short_title('...', 16);
            ?>
</a></h2>
                                
                                 </div>
                                
                                    
                        </li>
        
                    <?php 
        }
        ?>
                 
                
                
                </ul>
            
            </div>
            <div class="container builder woocommerce"><div>   <div> 
            <?php 
        wp_reset_query();
        ?>
			<?php 
    }
コード例 #2
0
    function block($instance)
    {
        extract($instance);
        $title = $instance['title'];
        $media_type = $instance['media_type_sel'];
        $categories = $instance['categories'];
        $posts = $instance['posts'];
        ?>
        
            <div class="widgetwrap ghost <?php 
        if ($right_lay == 1) {
            echo 'right-layout';
        } else {
        }
        ?>
">
			<?php 
        if ($title == "") {
        } else {
            ?>
			<h2 class="block"><a href="<?php 
            echo get_category_link($categories);
            ?>
"><?php 
            echo esc_attr($title);
            ?>
</a></h2>
            <div class="clearfix"></div>
			<?php 
        }
        ?>
        	
			<?php 
        $recent_posts = new WP_Query(array('showposts' => esc_attr($posts), 'cat' => $categories, 'ignore_sticky_posts' => 1));
        ?>
          
                <ul>
                
				<?php 
        $big_count = round($posts / 7);
        if (!$big_count) {
            $big_count = 1;
        }
        $counter = 1;
        while ($recent_posts->have_posts()) {
            $recent_posts->the_post();
            if ($counter <= $big_count) {
                if ($counter == $big_count) {
                    $last = 'block-item-big-last';
                } else {
                    $last = '';
                }
                ?>
                
                	<li class="media-big item">
                
						<?php 
                global $post;
                $video_input = get_post_meta($post->ID, 'tmnf_video', true);
                $iframe_input = get_post_meta($post->ID, 'tmnf_iframe', true);
                ?>
    
                        <?php 
                if ($media_type_sel == 'video') {
                    get_template_part('/functions/theme-video');
                } else {
                    ?>
                            
                             <div class="imgwrap">
                             
                             	<?php 
                    echo tmnf_ratings();
                    ?>
                            
                                 <a href="<?php 
                    tmnf_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
" >
                                 
                                    <?php 
                    the_post_thumbnail('media', array('class' => "tranz grayscale grayscale-fade"));
                    ?>
                                    
                                 </a>
                                 
                                 <?php 
                    tmnf_meta_counter();
                    ?>
                                 
                            </div>
                            
                        <?php 
                }
                ?>
 
                
                		<?php 
                get_template_part('/post-types/media-big');
                ?>
                
                	</li>
                
                
                <?php 
            } else {
                ?>
                
                	<?php 
                get_template_part('/post-types/media-small');
                ?>
                    
				<?php 
            }
            ?>
            
				<?php 
            $counter++;
        }
        ?>
                
                </ul>
                
                <?php 
        wp_reset_query();
        ?>
                
			</div><!-- end. widgetwrap -->
			<?php 
    }
コード例 #3
0
ファイル: slider.php プロジェクト: xiang-chen-git/LeanBlog
			<li class="item">
                    
				<?php 
if (has_post_thumbnail()) {
    ?>
                
                    <div class="imgwrap">
                
                        <?php 
    echo tmnf_ratings();
    ?>
                    
                         <a href="<?php 
    tmnf_permalink();
    ?>
" title="<?php 
    the_title();
    ?>
" >
                         
                            <?php 
    the_post_thumbnail('main-slider', array('class' => "tranz grayscale grayscale-fade"));
    ?>
                            
                         </a>
                         
                    </div>
                    
                <?php 
}
?>