Created
June 15, 2018 12:41
-
-
Save rushijagani/1a147fe955e1891c02b0061f0308785b to your computer and use it in GitHub Desktop.
Default Blog / Archive and Single Blog Post sidebar applied to the Custom Post Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Default Blog / Archive and Single Blog Post sidebar applied to the Custom Post Type */ | |
add_filter( 'astra_page_layout', 'custom_post_type_custom_sidebar' ); | |
/** | |
* @link https://codex.wordpress.org/Conditional_Tags | |
*/ | |
function custom_post_type_custom_sidebar( $sidebar ){ | |
$blog_archive_sidebar = astra_get_option('archive-post-sidebar-layout'); | |
$single_post_sidebar = astra_get_option('single-post-sidebar-layout'); | |
if ( is_post_type_archive( 'projeto' ) ) { | |
$sidebar = $blog_archive_sidebar; | |
} | |
if ( is_singular( 'projeto' ) ) { | |
$sidebar = $single_post_sidebar; | |
} | |
return $sidebar; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment