Created
September 8, 2013 17:59
-
-
Save jbutko/6486941 to your computer and use it in GitHub Desktop.
WP, php, functions.php: Widget area
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
//functions.php | |
function minima_widgets_init() { | |
register_sidebar( array( | |
'name' => __( 'Sidebar', 'minima' ), | |
'id' => 'sidebar-1', | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h1 class="widget-title">', | |
'after_title' => '</h1>', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Tweets', 'minima' ), | |
'id' => 'tweets-widget-area', | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h1 class="widget-title">', | |
'after_title' => '</h1>', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Latest posts', 'minima' ), | |
'id' => 'latest-posts-widget-area', | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h1 class="widget-title">', | |
'after_title' => '</h1>', | |
) ); | |
} | |
add_action( 'widgets_init', 'minima_widgets_init' ); | |
//index.php | |
<?php | |
// Custom widget Area Start | |
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Tweets') ) : ?> | |
<p>Latest tweet example</p> | |
<?php endif; | |
// Custom widget Area End | |
?> | |
<h3>LATESTS POSTS</h3> | |
<?php | |
// Custom widget Area Start | |
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Latest posts') ) : ?> | |
<p>Latest tweet example</p> | |
<?php endif; | |
// Custom widget Area End | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment