Astra_LearnDash::sidebar_layout( string $layout )
LeanDash Sidebar
Description
Parameters
- $layout
-
(string) (Required) Layout type.
Return
(string) $layout Layout type.
Source
File: inc/compatibility/learndash/class-astra-learndash.php
public function sidebar_layout( $layout ) {
if ( is_singular( 'sfwd-courses' ) || is_singular( 'sfwd-lessons' ) || is_singular( 'sfwd-topic' ) || is_singular( 'sfwd-quiz' ) || is_singular( 'sfwd-certificates' ) || is_singular( 'sfwd-assignment' ) ) {
$learndash_sidebar = astra_get_option( 'learndash-sidebar-layout' );
if ( 'default' !== $learndash_sidebar ) {
$layout = $learndash_sidebar;
}
$sidebar = astra_get_option_meta( 'site-sidebar-layout', '', true );
if ( 'default' !== $sidebar && ! empty( $sidebar ) ) {
$layout = $sidebar;
}
}
// When Learhdash shortoce is used on the Page.
// Applied only to the pages which uses the learndash shortcode.
global $learndash_shortcode_used;
if ( $learndash_shortcode_used && ! ( is_singular( 'sfwd-courses' ) || is_singular( 'sfwd-lessons' ) || is_singular( 'sfwd-topic' ) || is_singular( 'sfwd-quiz' ) || is_singular( 'sfwd-certificates' ) || is_singular( 'sfwd-assignment' ) ) ) {
// Page Meta Sidebar.
$layout = astra_get_option_meta( 'site-sidebar-layout', '', true );
if ( empty( $layout ) ) {
// Page Sidebar.
$layout = astra_get_option( 'single-page-sidebar-layout' );
// Default Site Sidebar.
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 $layout;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.3.0 | Introduced. |