wp develop widget code example
Example 1: how create widget widget in wordpress
/* add this code in footer.php child theme file */
<div id="footer-sidebar" class="secondary">
<div id="footer-sidebar1">
<?php
if(is_active_sidebar('footer-sidebar-1')){
dynamic_sidebar('sidebar1');
}
?>
</div>
<div id="footer-sidebar2">
<?php
if(is_active_sidebar('footer-sidebar-2')){
dynamic_sidebar('sidebar2');
}
?>
</div>
</div>
/* add this code in functions.php child theme file */
register_sidebar( array(
'name' => 'Footer #1',
'id' => 'sidebar1',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => 'Footer #2',
'id' => 'sidebar2',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'wp_enqueue_scripts', 'twentytwenty_child_enqueue_child_styles' );
Example 2: how create widget widget in wordpress
display:block;
height: 250px;
}
float: left;
width: 340px;
margin-left:5px;
margin-right:5px;
}
float: left;
width: 340px;
margin-right:5px;
margin-left:5px;
}