summaryrefslogtreecommitdiff
path: root/inc/core/sidebar-manager.php
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2021-07-21 14:54:07 -0500
committerZach van Rijn <me@zv.io>2021-07-21 14:54:07 -0500
commit9d4123cee1867ee7199b06bdc92d40611f547ecc (patch)
tree6d864e2725242863afed1f8ba12d9c7a9bc63a69 /inc/core/sidebar-manager.php
downloadblog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.gz
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.bz2
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.xz
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.zip
Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/.
Diffstat (limited to 'inc/core/sidebar-manager.php')
-rw-r--r--inc/core/sidebar-manager.php82
1 files changed, 82 insertions, 0 deletions
diff --git a/inc/core/sidebar-manager.php b/inc/core/sidebar-manager.php
new file mode 100644
index 0000000..a191020
--- /dev/null
+++ b/inc/core/sidebar-manager.php
@@ -0,0 +1,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 );
+ }
+}