I have created some widgets for my WordPress site. I use fallback data widget WordPress which I got form this free WordPress theme: https://wordpress.org/themes/brightpage.
So, if I don't put any content in my widget, then show the default content. But when I put anything into the widget like text or image, then default content would be disappear and the content which I just put into the widget would be appear.
But when I put something in Widget such as text or image it not change dynamically form the widget area in WordPress admin panel.
I want to share at least two examples from my WordPress site. This code form header.php:
<header class="fix header_top_area">
<div class="fix container header_top">
<?php if ( ! dynamic_sidebar( 'header-top' ) ) : ?>
<div class="fix floatright header_top_text">
<div class="fix floatleft call">
<p>Chicago, USA, Call : 00 000 0000</p>
</div>
<div class="fix floatleft sign_in">
<a href="">Sign In</a>
</div>
</div>
<?php endif; ?>
</div>
</header>
<header class="fix header_bottom_area">
<?php if ( ! dynamic_sidebar( 'header-bottom' ) ) : ?>
<div class="fix container header_bottom">
<figure class="fix floatleft logo">
<a href="<?php bloginfo('home'); ?>"><img src="<?php bloginfo('template_url');?>/img/logo.png" alt="" /></a>
</figure>
<figure class="fix floatright image_header">
<a href=""><img src="<?php bloginfo('template_url');?>/img/image_header.jpg" alt="" /></a>
</figure>
</div>
<?php endif; ?>
This code form functions.php:
add_action('widgets_init', 'wp_widget_areas');
function wp_widget_areas() {
register_sidebar( array(
'name' => __( 'Home Page Widget Header Top', 'Perfect Point' ),
'id' => 'header-top',
'before_widget' => '<div class="fix floatright header_top_text">',
'after_widget' => '</div>',
'before_title' => '<h2 style="display:none">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => __( 'Home Page Widget Header Bottom', 'Perfect Point' ),
'id' => 'header-bottom',
'before_widget' => '<div class="fix container header_bottom">',
'after_widget' => '</div>',
'before_title' => '<h2 style="display:none">',
'after_title' => '</h2>',
) );
}
How could I active these widgets? Can anybody help me to fix it? Thanks.