Created
May 7, 2013 01:22
-
-
Save morktron/5529635 to your computer and use it in GitHub Desktop.
Add new widget areas to a Wordpress theme, then you must add some code to files where you want the widget or add them here via 'hooks'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function register_widget_area() { | |
add_action( 'widgets_init', 'register_widget_area' ); | |
// Hero widget area | |
if( function_exists( 'register_sidebar' ) ) { | |
register_sidebar( array( | |
'name' => 'Hero Widget', | |
'id' => 'hero_widget', | |
'description' => "Hero widget description in admin", | |
'before_widget' => '<aside class="hero">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h1 class="title">', | |
'after_title' => '</h1>', | |
) ); | |
} | |
// Top Contact widget area | |
if( function_exists( 'register_sidebar' ) ) { | |
register_sidebar( array( | |
'name' => 'Top Contact', | |
'id' => 'top_contact', | |
'description' => "Top Contact widget displayed on all pages", | |
'before_widget' => '<aside class="top-contact">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h1 class="title">', | |
'after_title' => '</h1>', | |
) ); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment