コード例 #1
0
       
                       <div class="list_desc">
                           <h4 class="list_title"><a class="post-title" href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="<?php 
        the_title_attribute();
        ?>
">
							<?php 
        the_title();
        ?>
                            </a></h4>
                           
                   <?php 
        echo themeloy_feature_post_meta(get_the_ID());
        ?>
							<?php 
        $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id);
        $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review');
        $total_review = absint(themeloy_get_total_review($post_id));
        if ($post_review == '1') {
            ?>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php 
            echo themeloy_get_total_review(get_the_ID());
            ?>
%"></div>
</div>
</div>
コード例 #2
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base);
        if (!($number = absint($instance['number']))) {
            $number = 4;
        }
        if (!($cats = $instance["cats"])) {
            $cats = '';
        }
        // array to call recent posts.
        $themeloy_args = array('showposts' => $number, 'category__in' => $cats);
        $themeloy_widget = null;
        $themeloy_widget = new WP_Query($themeloy_args);
        echo $before_widget;
        // Widget title
        echo $before_title;
        echo $instance["title"];
        echo $after_title;
        // Post list in widget
        $i = 0;
        ?>
		<div class="widget_container">
        <?php 
        while ($themeloy_widget->have_posts()) {
            $themeloy_widget->the_post();
            $post_id = get_the_ID();
            $i++;
            $thumb = themeloy_get_thumbnail(get_the_ID());
            if ($i == 1) {
                ?>
   

                   <div class="main_post">
    <div class="image_post feature-item">
                   
                     <a href="<?php 
                the_permalink();
                ?>
"> 
<?php 
                if (has_post_thumbnail()) {
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'main-square');
                    ?>
        <img src="<?php 
                    echo $image[0];
                    ?>
" />
<?php 
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/images/demo/main-square.jpg' . '">';
                }
                ?>
	
                     </a>
          
                      <span class="caption">
                      <?php 
                $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID());
                $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post');
                if ($post_cat == '1') {
                    echo '<p class="cat-slider">';
                    echo the_category(', ') . '</p>';
                }
                ?>
                      <a href="<?php 
                the_permalink();
                ?>
"> <span><?php 
                the_title();
                ?>
</span></a> </span>
					<?php 
                echo themeloy_post_type();
                ?>
							<?php 
                $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id);
                $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review');
                $total_review = absint(themeloy_get_total_review($post_id));
                if ($post_review == '1') {
                    ?>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php 
                    echo themeloy_get_total_review(get_the_ID());
                    ?>
%"></div>
</div>
</div>
 <?php 
                }
                ?>
 

                   
          
                     </div> 
                   
<?php 
                echo themeloy_post_meta(get_the_ID());
                ?>
                
 <p>
<?php 
                echo themeloy_short_title(300, get_the_excerpt(''));
                ?>
</p>  

                </div>
   
 					   <div class="list_post_vertical">
                      <ul>          
                
            <?php 
            } else {
                ?>
            
     <li>
       <?php 
                $post_date = get_post_custom_values('date_themeloy_select', get_the_ID());
                $post_date = $post_date[0] != '' ? $post_date[0] : of_get_option('blog_date_post');
                if ($post_date == '1') {
                    ?>
     <div class="feature_post_style">
                        <span class="post_date"><span class="date_number"><?php 
                    echo get_the_date('d');
                    ?>
</span> <?php 
                    echo get_the_date('M');
                    ?>
                        <i class="icon-caret-right feature-icon-right"></i>
                        </span>
                        <span class="post_time"><i class="icon-time"></i> <?php 
                    echo get_the_time('H:i');
                    ?>
</span>
                        </div>
                        <?php 
                }
                ?>
                        <div class="feature-link feature-item">
                       <a href="<?php 
                the_permalink();
                ?>
" class="feature-link">
<?php 
                if (has_post_thumbnail()) {
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'medium-feature');
                    ?>
        <img src="<?php 
                    echo $image[0];
                    ?>
" />	
<?php 
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/images/demo/medium-feature.jpg' . '">';
                }
                ?>
	
                       
                        </a>
                         <?php 
                echo themeloy_post_type();
                ?>
                        </div>
                        
                       <div class="list_desc">
                           <h4 class="list_title"><a class="post-title" href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                the_title_attribute();
                ?>
">
							<?php 
                the_title();
                ?>
                            </a></h4>
                           
                   <?php 
                echo themeloy_feature_post_meta(get_the_ID());
                ?>
							<?php 
                $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id);
                $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review');
                $total_review = absint(themeloy_get_total_review($post_id));
                if ($post_review == '1') {
                    ?>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php 
                    echo themeloy_get_total_review(get_the_ID());
                    ?>
%"></div>
</div>
</div>
 <?php 
                }
                ?>
 
                        
                        </div>  
                        <div class="clear"></div>                   
</li>
            
                <?php 
            }
        }
        ?>
            
			

   </ul>
            </div>
        </div>
      
        <?php 
        wp_reset_query();
        echo $after_widget;
    }
コード例 #3
0
    function block($instance)
    {
        extract($instance);
        $titles = apply_filters('widget_title', empty($instance['titles']) ? 'Recent Posts' : $instance['titles'], $instance, $this->id_base);
        $title1 = apply_filters('widget_title', empty($instance['title1']) ? 'Recent Posts' : $instance['title1'], $instance, $this->id_base);
        if (!($number_show = absint($instance['number_show']))) {
            $number_show = 5;
        }
        if (!($number_show1 = absint($instance['number_show1']))) {
            $number_show1 = 5;
        }
        if (!isset($instance["cats"])) {
            $cats = '';
        }
        if (!isset($instance["cats1"])) {
            $cats1 = '';
        }
        // array to call recent posts.
        $themeloy_args = array('showposts' => $number_show1, 'category__in' => $cats);
        $themeloy_args1 = array('showposts' => $number_show, 'category__in' => $cats1);
        $themeloy_widget = null;
        $themeloy_widget = new WP_Query($themeloy_args);
        // Widget title
        // Post list in widget
        $i = 0;
        ?>
        <div class="widget main_post_style clearfix">
        
		<div class="widget_container">


<div class="main_post small-slider-list">

<?php 
        if (!empty($instance['titles'])) {
            ?>
<h3 class="widget-title"><span><?php 
            echo $instance["titles"];
            ?>
</span></h3><?php 
        }
        ?>
    
    
<div class="slider-wrapper-content theme-default">
<div id="slider" class="nivoSlider nivoSlider_content">
<?php 
        $i = 0;
        while ($themeloy_widget->have_posts()) {
            $i++;
            $themeloy_widget->the_post();
            $post_id = get_the_ID();
            ?>

<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            the_title_attribute();
            ?>
">
<?php 
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'slider-left-small');
                ?>
					<img src="<?php 
                echo $image[0];
                ?>
" title="<?php 
                echo '#htmlcaption-left' . $i;
                ?>
" data-transition="<?php 
                echo of_get_option('slider_effect_option');
                ?>
" />
                    
<?php 
            } else {
                echo '<img src="' . get_template_directory_uri() . '/images/demo/slider-left-small.jpg' . '" title="#htmlcaption-slide' . $i . '">';
            }
            ?>
</a>
<?php 
        }
        ?>
</div>         

 <?php 
        $i = 0;
        while ($themeloy_widget->have_posts()) {
            $themeloy_widget->the_post();
            $i++;
            $post_id = get_the_ID();
            ?>
       
        
         <div id="htmlcaption-left<?php 
            echo $i;
            ?>
" class="nivo-html-caption">
         <?php 
            $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID());
            $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post');
            if ($post_cat == '1') {
                echo '<p class="cat-slider">';
                echo the_category(', ') . '</p>';
            }
            ?>

          <div class="caption-slider-text">

              <h5><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h5> 
              <?php 
            echo themeloy_single_post_meta(get_the_ID());
            ?>
              							<?php 
            $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id);
            $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review');
            $total_review = absint(themeloy_get_total_review($post_id));
            if ($post_review == '1') {
                ?>
<div class="clear"></div>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php 
                echo themeloy_get_total_review(get_the_ID());
                ?>
%"></div>
</div>
</div>

 <?php 
            }
            ?>
 
 </div>     

            </div>
        <?php 
        }
        ?>

</div>

                </div>
   
 					   <div class="list_post_vertical home_slider_carousel">
                       <?php 
        if (!empty($instance['title1'])) {
            ?>
<h3 class="widget-title"><span><?php 
            echo $instance["title1"];
            ?>
</span></h3><?php 
        }
        ?>
                       
                      <ul id="mycarousel" class="jcarousel_vertical jcarousel-skin-tango">          
                
<?php 
        wp_reset_query();
        $themeloy_widget1 = null;
        $themeloy_widget1 = new WP_Query($themeloy_args1);
        while ($themeloy_widget1->have_posts()) {
            $themeloy_widget1->the_post();
            $post_id = get_the_ID();
            ?>
            
     <li>
       <?php 
            $post_date = get_post_custom_values('date_themeloy_select', get_the_ID());
            $post_date = $post_date[0] != '' ? $post_date[0] : of_get_option('blog_date_post');
            if ($post_date == '1') {
                ?>
     <div class="feature_post_style">
                        <span class="post_date"><span class="date_number"><?php 
                echo get_the_date('d');
                ?>
</span> <?php 
                echo get_the_date('M');
                ?>
                        <i class="icon-caret-right feature-icon-right"></i>
                        </span>
                        <span class="post_time"><i class="icon-time"></i> <?php 
                echo get_the_time('H:i');
                ?>
</span>
                        </div>
                        <?php 
            }
            ?>
                        <div class="feature-link feature-item">
                       <a href="<?php 
            the_permalink();
            ?>
" class="feature-link">
<?php 
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'medium-feature');
                ?>
    <img src="<?php 
                echo $image[0];
                ?>
" />
<?php 
            } else {
                echo '<img src="' . get_template_directory_uri() . '/images/demo/medium-feature.jpg' . '">';
            }
            ?>
                        
                        </a>
                        <?php 
            echo themeloy_post_type();
            ?>
                        </div>
                        
                       <div class="list_desc">
                           <h4 class="list_title"><a class="post-title" href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            the_title_attribute();
            ?>
">
							<?php 
            the_title();
            ?>
                            </a></h4>
                           
                   <?php 
            echo themeloy_feature_post_meta(get_the_ID());
            ?>
							<?php 
            $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id);
            $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review');
            $total_review = absint(themeloy_get_total_review($post_id));
            if ($post_review == '1') {
                ?>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php 
                echo themeloy_get_total_review(get_the_ID());
                ?>
%"></div>
</div>
</div>
 <?php 
            }
            ?>
 
                        
                        </div>                     
</li>
            
                <?php 
        }
        ?>
            
			

   </ul>
            </div>
        </div>
         </div>
      
        <?php 
        wp_reset_query();
    }