Skip to content

Instantly share code, notes, and snippets.

@rushijagani
Created June 15, 2018 12:41
Show Gist options
  • Save rushijagani/1a147fe955e1891c02b0061f0308785b to your computer and use it in GitHub Desktop.
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
<?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