Created
November 18, 2016 07:11
-
-
Save sarvar/0038371c66dc7c52886df43e736a6a3a to your computer and use it in GitHub Desktop.
Adding widget to Wordpress
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
in functions.php: | |
//add a widget area in the header as described by TomHart | |
if ( function_exists ('register_sidebar') ) | |
register_sidebar( array( | |
'name' => __( 'Header Widgets Area', 'twentythirteen' ), | |
'id' => 'sidebar-header', | |
'description' => __( 'Header widgets area for my child theme.' , 'twentythirteen' ), | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
) ); | |
in header.php: | |
<?php if ( !function_exists('dynamic_sidebar') || | |
!dynamic_sidebar('Header Widgets Area') ) : | |
endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment