blob: a191020d1a0627567e44ef193477b87f80b79248 (
plain) (
blame)
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
|
<?php
/**
* Sidebar Manager functions
*
* @package Astra
* @author Astra
* @copyright Copyright (c) 2020, Astra
* @link https://wpastra.com/
* @since Astra 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Site Sidebar
*/
if ( ! function_exists( 'astra_page_layout' ) ) {
/**
* Site Sidebar
*
* Default 'right sidebar' for overall site.
*/
function astra_page_layout() {
if ( is_singular() ) {
// If post meta value is empty,
// Then get the POST_TYPE sidebar.
$layout = astra_get_option_meta( 'site-sidebar-layout', '', true );
if ( empty( $layout ) ) {
$post_type = get_post_type();
if ( 'post' === $post_type || 'page' === $post_type || 'product' === $post_type ) {
$layout = astra_get_option( 'single-' . get_post_type() . '-sidebar-layout' );
}
if ( 'default' == $layout || empty( $layout ) ) {
// Get the global sidebar value.
// NOTE: Here not used `true` in the below function call.
$layout = astra_get_option( 'site-sidebar-layout' );
}
}
} else {
if ( is_search() ) {
// Check only post type archive option value.
$layout = astra_get_option( 'archive-post-sidebar-layout' );
if ( 'default' == $layout || empty( $layout ) ) {
// Get the global sidebar value.
// NOTE: Here not used `true` in the below function call.
$layout = astra_get_option( 'site-sidebar-layout' );
}
} else {
$post_type = get_post_type();
$layout = '';
if ( 'post' === $post_type ) {
$layout = astra_get_option( 'archive-' . get_post_type() . '-sidebar-layout' );
}
if ( 'default' == $layout || empty( $layout ) ) {
// Get the global sidebar value.
// NOTE: Here not used `true` in the below function call.
$layout = astra_get_option( 'site-sidebar-layout' );
}
}
}
return apply_filters( 'astra_page_layout', $layout );
}
}
|