This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar.php
66 lines (56 loc) · 2.27 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
<?php
/**
* The Sidebar containing the main widget areas.
*/
?>
<div class="clearfix"></div>
<div id="sidebar" class="widget-area clearfix" role="complementary">
<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
<aside id="categories" class="widget">
<div class="widget-title"><?php _e( 'Categories', 'magazino' ); ?></div>
<ul>
<?php wp_list_categories( array(
'title_li' => '',
'hierarchical' => 0
) ); ?>
</ul>
</aside>
<aside id="recent-posts" class="widget">
<div class="widget-title"><?php _e( 'Recent Posts', 'magazino' ); ?></div>
<ul>
<?php
$args = array( 'numberposts' => '10' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
if ($recent["post_title"] == '') {
$recent["post_title"] = __('View Post', 'magazino');
}
echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"] .'</a> </li> ';
}
?>
</ul>
</aside>
<aside id="popular-posts" class="widget">
<div class="widget-title"><?php _e( 'Popular Posts', 'magazino' ); ?></div>
<ul>
<?php $pc = new WP_Query( array(
'orderby' => 'comment_count',
'posts_per_page' => 10,
'ignore_sticky_posts' => 1
) ); ?>
<?php while ($pc->have_posts()) : $pc->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php if(the_title( '', '', false ) !='') the_title(); else _e( 'View Post', 'magazino' ); ?></a>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>
</aside>
<aside id="archives" class="widget">
<div class="widget-title"><?php _e( 'Archives', 'magazino' ); ?></div>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
<?php endif; // end sidebar widget area ?>
</div><!-- #sidebar .widget-area -->