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
Richard

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
Richard

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:

<?php
the_post();

get_header();
?>
<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' );

		comments_template();
		?>
		<?php get_sidebar(); ?>
	</main>
</div>
<?php
get_footer();

Hi,

Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features https://hivepress.io/support-policy/

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 https://fvrr.co/32e7LvY

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