Get the current layout.
This function return the current layout according the the view it is called from.
beans_get_layout( )
Return: (bool) Layout, false if no layout found.
Source
function beans_get_layout() {
if ( is_singular() ) {
$layout = beans_get_post_meta( 'beans_layout' );
} elseif ( is_home() && ( 0 != ( $posts_page = get_option( 'page_for_posts' ) ) ) ) {
$layout = beans_get_post_meta( 'beans_layout', false, $posts_page );
} elseif ( is_category() || is_tag() || is_tax() ) {
$layout = beans_get_term_meta( 'beans_layout' );
}
// Fallback onto the global theme layout option if value is false or default_fallback.
if ( ! isset( $layout ) || ! $layout || 'default_fallback' === $layout ) {
$layout = get_theme_mod( 'beans_layout', beans_get_default_layout() );
}
/**
* Filter the layout id.
*
* @since 1.0.0
*
* @param string $layout The layout id.
*/
return apply_filters( 'beans_layout', $layout );
}