Quantcast
Viewing all articles
Browse latest Browse all 13547

Arthur Gareginyan on "[Theme: Anarcho Notepad] Adding "footers" on the theme?"

Hi,

Thank you for the nice words!

At the end of the functions.php file place this code:

// This feature enables widgets area in the footer.
function anarcho_widgets_footer_init() {
	register_sidebar(array(
			'name' => __('Footer Area 1', 'anarcho-notepad'),
			'id' => 'footer-1',
			'description' => __('Widgets in this area will be shown left.', 'anarcho-notepad'),
			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
			'after_widget' => '</aside>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>',
	));
		register_sidebar(array(
			'name' => __('Footer Area 2', 'anarcho-notepad'),
			'id' => 'footer-2',
			'description' => __('Widgets in this area will be shown center.', 'anarcho-notepad'),
			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
			'after_widget' => '</aside>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>',
	));
		register_sidebar(array(
			'name' => __('Footer Area 3', 'anarcho-notepad'),
			'id' => 'footer-3',
			'description' => __('Widgets in this area will be shown right.', 'anarcho-notepad'),
			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
			'after_widget' => '</aside>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>',
	));
}
add_action( 'widgets_init', 'anarcho_widgets_footer_init' );

At the end of the style.css file place this code:

// Footer Widgets
#footer-widgets {
	display:block;
	height: 250px;
}
#footer-widgets span {
	float: left;
	width: 30%;
	margin-left:5px;
	margin-right:5px;
}

In the footer.php file, find this block:

<div class="site-info">
	<?php echo get_theme_mod('site-info'); ?>
  </div>

and replace for this:

<div class="site-info">
	<div id="footer-widgets">
		<span><?php dynamic_sidebar( 'footer-1' ); ?></span>
		<span><?php dynamic_sidebar( 'footer-2' ); ?></span>
		<span><?php dynamic_sidebar( 'footer-3' ); ?></span>
	</div>
	<br clear="all">
	<?php echo get_theme_mod('site-info'); ?>
  </div>

Now you can add widgets in the footer from "Admin Panel" -> "Appearance" -> "Widgets".

I'll add this option in the next update of the "Anarcho Notepad" theme.


Viewing all articles
Browse latest Browse all 13547

Trending Articles