Skip to content

Instantly share code, notes, and snippets.

@rushijagani
Created May 2, 2018 05:47
Show Gist options
  • Save rushijagani/6cd470405d6011d46113d0aff4111329 to your computer and use it in GitHub Desktop.
Save rushijagani/6cd470405d6011d46113d0aff4111329 to your computer and use it in GitHub Desktop.
Custom Post Type Container, Sidebar Layout same as Blog Post Single.
<?php
add_filter( 'astra_get_content_layout', 'custom_post_type_content_layout');
// Update the container layout for Custom Post Type same as Blog Post.
function custom_post_type_content_layout ( $layout ){
$single_post = astra_get_option( 'single-post-content-layout' );
// Add your CPT instead of newspaper, book. If it's only for one CPT then add just one CPT.
if ( is_singular( array( 'newspaper, book') ) ) {
$layout = $single_post;
}
return $layout;
}
add_filter( 'astra_page_layout', 'custom_post_type_page_layout');
// Update the Sidebar layout for Custom Post Type same as Blog Post.
function custom_post_type_page_layout ( $layout ){
$single_post = astra_get_option( 'single-post-sidebar-layout' );
// Add your CPT instead of newspaper, book. If it's only for one CPT then add just one CPT.
if ( is_singular( array( 'newspaper, book') ) ) {
$layout = $single_post;
}
return $layout;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment