forked from jonmbennett/betheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar-blog.php
78 lines (58 loc) · 2.04 KB
/
sidebar-blog.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
<?php
/**
* The Blog Sidebar containing the widget area.
*
* @package Betheme
* @author Muffin group
* @link http://muffingroup.com
*/
$sidebar = false;
$posts_page_id = false;
if( get_option( 'page_for_posts' ) ){
$posts_page_id = get_option( 'page_for_posts' ); // Setings / Reading
} elseif( mfn_opts_get( 'blog-page' ) ){
$posts_page_id = mfn_opts_get( 'blog-page' ); // Theme Options / Getting Started / Blog
}
$sidebars = mfn_opts_get( 'sidebars' );
// Category -----------------------------------------------
$theme_disable = mfn_opts_get( 'theme-disable' );
if( ! isset( $theme_disable['categories-sidebars'] ) ){
if( is_category() ){
$category = get_query_var( 'cat' );
$category = get_category( $category );
$cat_sidebar = 'blog-cat-'. $category->slug;
if( is_active_sidebar( $cat_sidebar ) ){
$sidebar = $cat_sidebar;
}
}
}
// Blog ---------------------------------------------------
if( ! $sidebar ){
$sidebar = get_post_meta( $posts_page_id, 'mfn-post-sidebar', true );
$sidebar = $sidebars[$sidebar];
}
if( $_GET && key_exists('mfn-s', $_GET) ){
$sidebar = esc_html( $_GET['mfn-s'] ); // demo
}
// sidebar 2 --------------------------------------------------------
$sidebar2 = get_post_meta( $posts_page_id, 'mfn-post-sidebar2', true);
if( $sidebar2 || $sidebar2 === '0' ) $sidebar2 = $sidebars[$sidebar2];
if( $_GET && key_exists('mfn-s2', $_GET) ){
$sidebar2 = esc_html( $_GET['mfn-s2'] ); // demo
}
// echo -------------------------------------------------------------
if( mfn_sidebar_classes() ){
echo '<div class="sidebar sidebar-1 four columns">';
echo '<div class="widget-area clearfix '. mfn_opts_get('sidebar-lines') .'">';
if ( ! dynamic_sidebar( $sidebar ) ) mfn_nosidebar();
echo '</div>';
echo '</div>';
// both sidebars
if( mfn_sidebar_classes( true ) ){
echo '<div class="sidebar sidebar-2 four columns">';
echo '<div class="widget-area clearfix '. mfn_opts_get('sidebar-lines') .'">';
if ( ! dynamic_sidebar( $sidebar2 ) ) mfn_nosidebar();
echo '</div>';
echo '</div>';
}
}