예제 #1
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $tabs1 = $instance['tabs1'];
        $tabs2 = $instance['tabs2'];
        $sortby = $instance['sortby'];
        if (empty($instance['basedby'])) {
            $basedby = 'comments';
        } else {
            $basedby = $instance['basedby'];
        }
        if ($sortby == 'this_week') {
            if (!function_exists('filter_where_week')) {
                function filter_where_week($where = '')
                {
                    //posts in the last 7 days
                    $where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
                    return $where;
                }
            }
            add_filter('posts_where', 'filter_where_week');
        } elseif ($sortby == 'this_month') {
            if (!function_exists('filter_where_month')) {
                function filter_where_month($where = '')
                {
                    //posts in the last 30 days
                    $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
                    return $where;
                }
            }
            add_filter('posts_where', 'filter_where_month');
        } elseif ($sortby == 'three_month') {
            if (!function_exists('filter_where_t_month')) {
                function filter_where_t_month($where = '')
                {
                    //posts in the last 30 days
                    $where .= " AND post_date > '" . date('Y-m-d', strtotime('-90 days')) . "'";
                    return $where;
                }
            }
            add_filter('posts_where', 'filter_where_t_month');
        } else {
        }
        /* Before widget (defined by themes). */
        echo $before_widget;
        ?>

		<ul class="clearfix tabs-menu">
            <li>
	            <?php 
        if ($tabs1 == 'popular') {
            ?>
	            	<?php 
            _e('Popular', 'rehub_child');
            ?>
	            <?php 
        } elseif ($tabs1 == 'comments') {
            ?>
	            	<?php 
            _e('Comments', 'rehub_child');
            ?>
	            <?php 
        } elseif ($tabs1 == 'category') {
            ?>
	
	            	<?php 
            _e('Categories', 'rehub_child');
            ?>
	            <?php 
        } else {
            ?>
            
	            	<?php 
            _e('Tags', 'rehub_child');
            ?>
	            
	            <?php 
        }
        ?>
	
            </li>
            <li>
	            <?php 
        if ($tabs2 == 'popular') {
            ?>
	            	<?php 
            _e('Popular', 'rehub_child');
            ?>
	            <?php 
        } elseif ($tabs2 == 'comments') {
            ?>
	            	<?php 
            _e('Comments', 'rehub_child');
            ?>
	            <?php 
        } elseif ($tabs2 == 'category') {
            ?>
	
	            	<?php 
            _e('Categories', 'rehub_child');
            ?>
	            <?php 
        } else {
            ?>
            
	            	<?php 
            _e('Tags', 'rehub_child');
            ?>
	            
	            <?php 
        }
        ?>
	
            </li>
       </ul>
    <div>
       <div class="tabs-item clearfix">
   			<?php 
        if ($tabs1 == 'popular') {
            ?>
            	<?php 
            rehub_most_popular_widget_block($basedby, $sortby);
            ?>
            <?php 
        } elseif ($tabs1 == 'comments') {
            ?>
            	<?php 
            rehub_latest_comment_widget_block();
            ?>
            <?php 
        } elseif ($tabs1 == 'category') {
            ?>
	
            	<?php 
            rehub_category_widget_block();
            ?>
            <?php 
        } else {
            ?>
            
            	<div class="tagcloud"><?php 
            wp_tag_cloud();
            ?>
</div> 	            
            <?php 
        }
        ?>
	      	
       	</div>
       <div class="tabs-item">
          	<?php 
        if ($tabs2 == 'popular') {
            ?>
            	<?php 
            rehub_most_popular_widget_block($basedby);
            ?>
            <?php 
        } elseif ($tabs2 == 'comments') {
            ?>
            	<?php 
            rehub_latest_comment_widget_block();
            ?>
            <?php 
        } elseif ($tabs2 == 'category') {
            ?>
	
            	<?php 
            rehub_category_widget_block();
            ?>
            <?php 
        } else {
            ?>
            
            	<div class="tagcloud"><?php 
            wp_tag_cloud();
            ?>
</div>	            
            <?php 
        }
        ?>
	    	
       	</div>
   </div>
			
		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
예제 #2
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $tabs1 = $instance['tabs1'];
        $tabs2 = $instance['tabs2'];
        if (function_exists('icl_t')) {
            $titlefirst = icl_t('Widget title', 'widget_title_' . $this->id, $instance['titlefirst']);
        } else {
            $titlefirst = $instance['titlefirst'];
        }
        if (function_exists('icl_t')) {
            $titlesecond = icl_t('Widget title second', 'widget_title_second' . $this->id, $instance['titlesecond']);
        } else {
            $titlesecond = $instance['titlesecond'];
        }
        $sortby = $instance['sortby'];
        $sortbysec = $instance['sortbysec'];
        if (!empty($instance['dark'])) {
            $color = 'dark';
        } else {
            $color = '';
        }
        if (empty($instance['basedby'])) {
            $basedby = 'comments';
        } else {
            $basedby = $instance['basedby'];
        }
        if (empty($instance['basedbysec'])) {
            $basedbysec = 'views';
        } else {
            $basedbysec = $instance['basedbysec'];
        }
        /* Before widget (defined by themes). */
        echo $before_widget;
        ?>

		<ul class="clearfix tabs-menu">
            <li>
				<?php 
        echo $titlefirst;
        ?>
            </li>
            <li>
				<?php 
        echo $titlesecond;
        ?>
	
            </li>
       </ul>
    <div class="color_sidebar<?php 
        if ($color == 'dark') {
            ?>
 dark_sidebar<?php 
        }
        ?>
">
       <div class="tabs-item clearfix">
   			<?php 
        if ($tabs1 == 'popular') {
            ?>
            	<?php 
            rehub_most_popular_widget_block($basedby, $sortby);
            ?>
            <?php 
        } elseif ($tabs1 == 'comments') {
            ?>
            	<?php 
            rehub_latest_comment_widget_block();
            ?>
            <?php 
        } elseif ($tabs1 == 'category') {
            ?>
	
            	<?php 
            rehub_category_widget_block();
            ?>
            <?php 
        } else {
            ?>
            
            	<div class="tagcloud"><?php 
            wp_tag_cloud();
            ?>
</div> 	            
            <?php 
        }
        ?>
	      	
       	</div>
       <div class="tabs-item">
          	<?php 
        if ($tabs2 == 'popular') {
            ?>
            	<?php 
            rehub_most_popular_widget_block($basedbysec, $sortbysec);
            ?>
            <?php 
        } elseif ($tabs2 == 'comments') {
            ?>
            	<?php 
            rehub_latest_comment_widget_block();
            ?>
            <?php 
        } elseif ($tabs2 == 'category') {
            ?>
	
            	<?php 
            rehub_category_widget_block();
            ?>
            <?php 
        } else {
            ?>
            
            	<div class="tagcloud"><?php 
            wp_tag_cloud();
            ?>
</div>	            
            <?php 
        }
        ?>
	    	
       	</div>
   </div>
			
		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }