Show sidebar on static homepage

Hi everybody,

I am actually doing a website for my training and I chose this theme.

It’s one of the better than I could ever find but, there is always a but, I don’t know how to show my sidebar on the static page I defined as homepage.

Is someone here to help me ? I will be thankful to all of you for your help.

Have all a nice day, evening, whatever wherever you are, enjoy your day.

GuillaumeVZ

This theme instead of having sidebar, has it own dedicated homepage widgets that are displayed below the Page.

However, it is easy to fix this. Open front-page.php file and replace the current code with this one

<?php

    if ( get_option( 'show_on_front' ) == 'posts' ) {
        get_template_part( 'index' );
    } elseif ( 'page' == get_option( 'show_on_front' ) ) {

get_header(); ?>

<?php dazzling_featured_slider(); ?>
<?php dazzling_call_for_action(); ?>

<div id="content" class="site-content container">
	<div id="primary" class="content-area col-sm-8 col-md-8">
		<main id="main" class="site-main" role="main">

			<?php while ( have_posts() ) : the_post(); ?>

				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<div class="entry-content">
						<?php the_content(); ?>
						<?php
							wp_link_pages( array(
								'before' => '<div class="page-links">' . __( 'Pages:', 'dazzling' ),
								'after'  => '</div>',
							) );
						?>
					</div><!-- .entry-content -->
					<?php edit_post_link( __( 'Edit', 'dazzling' ), '<footer class="entry-meta"><i class="fa fa-pencil-square-o"></i><span class="edit-link">', '</span></footer>' ); ?>
				</article><!-- #post-## -->

				<?php get_sidebar( 'home' ); ?>

				<?php
					// If comments are open or we have at least one comment, load up the comment template
					if ( comments_open() || '0' != get_comments_number() ) :
						comments_template();
					endif;
				?>

			<?php endwhile; // end of the loop. ?>

		</main><!-- #main -->
	</div><!-- #primary -->

<?php
	get_sidebar();
	get_footer();
}
?>

There is nothing much changed between original code and this one but it is so much easier to just copy/page the entire thing that trying to explain which lines you should change.

Thank you a lot it works fine !

Will this code also work on the Sparkling theme to get the sidebar on the home page?

I am also trying to do this on Sparkling. I tried a few things but I haven’t got it to work right yet.

This discussion is related to Dazzling instead of Sparkling theme and they are different.

For Sparkling you just need to rename or remove front-page.php file from theme folder and you are ready to go. This won’t cause any errors or anything, it will just make sure that theme uses page.php template instead of front-page.php.

In Sparkling - I made the change you suggested but the sidebar still does not appear on the homepage when set to static. Thanks.

I got it to work! I checked the template setting on my “home” page, that setting was still set to “full width (no sidebar)”, I changed it to default.

thanks!

Hey Aigars,

Thank for your support. I followed your instruction, but the sidebar appears on the right of Front page. And I can change it to Leftsidebar, I tried to choose Left sidebar option in Theme Option, but it not work. Is there any way to have Left Sidebar on Front Page?

Thank you so much :slight_smile:

Thanks for this! It worked like a charm. 2 follow-up questions: How can I get the widget sidebar to be on the left side? And is there a way to make the widget sidebar width on the homepage a different size than on the rest of the site?

Thanks in advance!

Hi,

How is this with the new version, as the file front-page.php doesn’t exist any more?
What do I have to do in order to have the sidebar on the right side on a static main page?
Thank you for your help.

Hi,

I’m trying to add a sidebar to my front page on UNITE theme (blog or static page)

Please can someone send me the code I can cut and page into the FRONT-PAGE.PHP template?

New at this!

Thanks in advance!

Darren

I’m also trying to add a sidebar to my site and I also can not.

In my case I can not put a sidebar on the blog page.

I tried the link solution above and it did not work.

Is there another solution?

The problem is in:

Thank you.

my theme is “unite”.