forked from TamerShlash/Sampression-Lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.php
89 lines (77 loc) · 2.98 KB
/
sidebar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
// Exit if accessed directly
if ( !defined('ABSPATH')) exit;
/**
* The Sidebar containing the main widget area.
*
* @package Sampression-Lite
* @since Sampression Lite 1.0
*/
?>
<aside id="sidebar" class="clearfix" role="complementary">
<?php
// Showing Popular Posts untill the user put any widget in Bottom widget 1
if (!dynamic_sidebar('bottom-widget-1')) : ?>
<section class="column one-third widget">
<header class="widget-title"><?php _e('Most Popular Posts', 'sampression'); ?></header>
<div class="widget-entry">
<?php $args = array(
'showposts' => 5,
'orderby' => 'comment_count'
);
query_posts($args);
if (have_posts()):
?>
<ul class="widget-popular-posts">
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="bookmark" ><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</div>
</section><!-- end of .widget-wrapper -->
<?php endif; //end of bottom-widget-1
// Showing Latest Comments untill the user put any widget in Bottom widget 2
if (!dynamic_sidebar('bottom-widget-2')) : ?>
<section class="column one-third widget">
<header class="widget-title"><?php _e('Recent Comments', 'sampression'); ?></header>
<div class="widget-entry">
<ul class="widget-commentlist">
<?php
$args = array(
'status' => 'approve',
'number' => '3'
);
$comments = get_comments($args);
foreach ($comments as $comment) {
$url = '<a href="'. get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">';
echo '<li class="clearfix">';
echo $url;
echo get_avatar( $comment->comment_author_email, 25);
echo '</a>';
echo '<div class="cmt-txt">';
echo 'By ';
echo $comment->comment_author;
echo ': ';
echo $url;
echo substr($comment->comment_content,0,80). '...';
echo '</a></div>';
echo '</li>';
}
?>
</ul>
<!-- .widget-list-comments -->
</div>
</section>
<?php endif;
// Showing Dummy Text untill the user put any widget in Bottom widget 2
if (!dynamic_sidebar('bottom-widget-3')) : ?>
<!--<section class="column one-third widget">
<header class="widget-title"><?php _e('About me', 'sampression'); ?></header>
<div class="widget-entry">
<?php _e('This is your Third Bottom Widget box (Bottom Widget 3). To edit please go to Appearance > Widgets and choose 3rd widget from the top in area second called Bottom Widget 3. Title is also manageable from widgets as well.','sampression'); ?>
</div> -->
</section>
<!-- end of .widget-wrapper -->
<?php endif; //end of bottom-widget-3 ?>
</aside>