-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar.php
64 lines (53 loc) · 1.74 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
<?php
/**
* The sidebar containing the main widget area.
*
* @package mindup
*/
/**
* Conditional for popular posts sidebar. //removed pop posts
* Added is_product for woocommerce
* @see https://docs.woothemes.com/document/conditional-tags/
*/
if ( is_single() ) :
if ( class_exists( 'WooCommerce' ) )
if ( is_product() ) return; ?>
<aside id="secondary" class="widget-area" role="complementary">
<?php get_search_form(); ?>
<ul class="tabs">
<li><a href="#tab2">Recent</a></li>
</ul>
<div id="tab2">
<?php
$recent_args = array (
'post_type' => 'post',
'no_found_rows' => true,
'posts_per_page' => 6,
'ignore_sticky_posts' => true
);
$recent_posts = new WP_Query( $recent_args );
if ( $recent_posts->have_posts() ) :
while ( $recent_posts->have_posts() ) : $recent_posts->the_post();
$post_title = get_the_title();
$post_title_short = wp_trim_words( $post_title, 10, '…' ); ?>
<div class="postList">
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php echo get_permalink( get_the_ID() ); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a>
<?php endif; ?>
<h4><a href="<?php echo get_permalink( get_the_ID() ); ?>" title="<?php the_title_attribute(); ?>"><?php echo $post_title_short; ?></a></h4>
</div>
<?php
endwhile;
else:
echo '<p>no recent posts</p>';
endif;
wp_reset_postdata(); ?>
</div>
</aside><!-- #secondary -->
<?php
elseif ( is_page() && is_active_sidebar( 'fullwidthtemplatesidebar' ) ) : ?>
<aside id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'fullwidthtemplatesidebar' ); ?>
</aside><!-- #secondary -->
<?php
endif;