Add sidebar to the blog post page

Hi there,
Before I look at modifying a core file in my child of ListingHive, I thought I would adsk if there is a code snippet that adds a sidebar to the single blog pages?
Many Thanks advance

Hi, Sorry I have found a previous post with the answer. So I just modified the single,php in my child to achieve it. If it helps anyone just change the main div to this

<main class="col-sm-8 col-xs-12 <?php if ( ! is_active_sidebar( 'blog_sidebar' ) ) : ?>col-sm-offset-2<?php endif; ?>"> and add <?php get_sidebar(); ?>

and add

<?php get_sidebar(); ?>

after end of main div

Thanks for sharing! Please make sure that you use a child theme to override the single.php file, otherwise any changes will be reset on update.

I´ve marked it as you told above but my “sidebar” is now a “top-Bar” :wink:


<div class="row">
<main class="col-sm-8 col-xs-12 <?php if ( ! is_active_sidebar( 'blog_sidebar' ) ) : ?>col-sm-offset-2<?php endif; ?>"> <?php get_sidebar(); ?> <?php
		get_template_part( 'templates/post-single' );

		<?php get_sidebar(); ?>


Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.