I am facing problems with the sidebar widgets.I have registered sidebar and used wp default sidebars but it is neither within its container div not printing before_widget
and after_widget
add_action( 'widgets_init', 'my_sidebar_widget' );
function my_sidebar_widget(){
register_sidebar( array(
'name' => __('Home Page Sidebar', 'nefar'),
'id' => 'sidebar-1',
'before_widget' => '<div class="sidebar-block">',
'before_widget' => '</div>',
'before_title' => '<h4 class="sidebar-heading">',
'after_title' => '</h4>',
));
}
And the index.php codes are here
<?php
get_header();
?>
<div class="container">
<div class="row">
<div class="col-md-8">
<?php
if(have_posts()){
while(have_posts()){
the_post();
?>
<h3><?php the_title(); ?></h3>
<?php
}
}
?>
</div>
<div class="col-md-4">
<?php
dynamic_sidebar('sidebar-1');
?>
</div>
</div>
</div>
<?php
get_footer();
And on output page source code
<div class="container">
<div class="row">
<div class="col-md-8">
<h3>The 15 Secrets That You Shouldn’t Know About Toys.</h3>
<h3>eMusic’s owners believe they can convince users start buying songs again</h3>
<h3>Twitter invokes the allure of one of its biggest users for its billboard ads</h3>
<h3>Spring Asparagus with Creamy Burrata & Pesto</h3>
<h3>Falling Leaves: Endearing Portraits of a Grandmother, a Grandson</h3>
</div>
<div class="col-md-4">
</div><h4 class="sidebar-heading">Search</h4><form role="search" method="get" id="searchform" class="searchform" action="http://localhost/wordpress/">
<div>
<label class="screen-reader-text" for="s">Search for:</label>
<input type="text" value="" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form></li>
</div>
</div>
I Don't know whre the is coming from after the widget and the widget is outside col-md-4