dynamic footer wordpress code example

Example 1: wp+footer.php

add_action( 'init', 'cust_widget' );
function cust_widget()
{
	register_sidebar( array(
		'name' => 'Widget1',
		'id' => 'cust_footer_1',
		'before_widget' => '<div class="cst_widget">',
		'after_widget' => '</div>'

	) );

	register_sidebar( array(
		'name' => 'Widget2',
		'id' => 'cust_footer_2',
		'before_widget' => '<div class="cst_widget">',
		'after_widget' => '</div>'
	) );

	register_sidebar( array(
		'name' => 'Widget3',
		'id' => 'footer-3',
		'before_widget' => '<div class="cst_widget">',
		'after_widget' => '</div>'
	) );

	register_sidebar( array(
		'name' => 'footer-4',
		'id' => 'footer-4',
		'before_widget' => '<div class="cst_widget">',
		'after_widget' => '</div>'
		
	) );
}

Example 2: wp+footer.php

<div class="container">
			<div class="row">
					<div class="col-md-3">
								<div id="footer1" class="widget1">
									<?php dynamic_sidebar('cust_footer_1'); ?>
								</div>
							</div>
							<div class="col-md-3">
								<div id="footer2" class="widget1">
									<?php dynamic_sidebar('cust_footer_2'); ?>
								</div>
							</div>
							<div class="col-md-3">
								<div id="footer3" class="widget1">
									<?php dynamic_sidebar('footer-3'); ?>
								</div>
							</div>
							<div class="col-md-3">
								<div id="footer4" class="widget1">
									<?php dynamic_sidebar('footer-4'); ?>
								</div>
							</div>
						</div>
					</div>

Tags:

Php Example