side bar not available in pages, only posts

why is it that the sidebar is not able to be assigned inside the home “page”? The only way I can get side bar on home page, is forget about it…so have to create home page as a post. I dont want my site to have posts, except to create a featured image, and set that as slider in theme options. I definitely have set right sidebar for Website Layout Option in the theme options but it is not able to be chosen when the page is being edited. And I have set the site settings as a page for home page.
And if you are going to say you cant set home page with a side bar, only posts, then how to get just one post showing, without all the bits that go at the bottom, because its only the home page content I want on the home page.

see life4nations.org.nz/wp/
Many thanks
Gill

Gill,

Sidebar on all pages and posts are there by default but front page doesn’t have sidebar but there are 3 dedicated widget areas that you can use to add your widgets.

If you want to use regular sidebar for front page you should do the following:

  1. Inside your WordPress dashboard go to Appearance - Editor
  2. There on the right side find a file called front-page.php
  3. Remove everything from that file.
  4. And replace it with this code instead:
<?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-12 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();
}
?>

It is almost the same code as there is already with some light changes to make sidebar to appear.

Let me know if this helps.

thank you so much, Aigars, that is great. Lovely theme.
what about when the wordpress gets updated? or the theme? then code gets lost when it is reverted…do I have to create a child theme for this code to stay put?
Also, I have realised I also want to create multiple sidebars, so I dont have to repeat the same contents for every internal page, is that possible, to put in an option somewhere somehow, to create new sidebars somehow.

You can also make these changes via Child Theme. Sample Dazzling Child Theme can be downloaded from here.

Once you have downloaded this sample Child theme make sure to install it and activate. Then create a clean file inside Child Theme folder and name it front-page.php or copy/paste existing file from Parent Theme folder to Child Theme folder. Then just copy above mentioned code inside this newly created file and you are good to go. This modification will replace default front-page.php template and it will also be update safe.

Let me know if you have any other question.

That suggestion worked excellently.This is really marvellous help you give for a free theme.

So my other question about being able to create more sidebars, i.e. up to 3 more different ones for different sub pages; I would guess this was something you cant really provide on your free theme.
No problem I understand, its just that you didnt say anything so I dont know if you can or can’t assist me with being able to create more side bars for inner pages.
Its just that I am almost doing the rebuilds for free myself, because I am doing 3 church websites with the same charity.

Sorry somehow missed that part.

You can use plugin called WooSidebars to use a different sidebar on a different page. You can read more about this plugin and download it form here.

Let me know if this is what you were looking for.