I have two sidebars registered. One called Sidebar (sidebar-1) and the other called Blog Sidebar (sidebar-2).
I would like to display the Blog sidebar on the blog index and single posts. As WordPress doesn't have a conditional tag for the blog page, I have tried the following via sidebar.php
:
<?php
if ( is_front_page() && is_home() ) {
// Default homepage - Do nothing
} elseif ( is_front_page() ) {
// Static homepage - Do nothing
} elseif ( is_home() && is_single() ) {
// Display blog sidebar
?>
<aside>
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</aside>
<?php
} else {
// Display main sidebar
?>
<aside>
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</aside>
<?php } ?>
When I go to the blog index and single post, I'm expecting to see the Blog Sidebar (sidebar-2), but I'm seeing the Sidebar (sidebar-1) instead.
Via reading settings, I have selected a page for my blog posts.