Created
March 27, 2015 18:15
-
-
Save eri-trabiccolo/77f1ffbc56e24131169c to your computer and use it in GitHub Desktop.
Extra widget area after header in home
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
// Adds a widget area. | |
if (function_exists('register_sidebar')) { | |
register_sidebar( array( | |
'name' => 'Extra Header Widget Area', | |
'id' => 'extra-header-widget-area', | |
'description' => 'Extra widget area after the header', | |
'before_widget' => '<div class="widget my-extra-header-widget">', | |
'after_widget' => '</div>', | |
'before_title' => '<h2>', | |
'after_title' => '</h2>' | |
) | |
); | |
} | |
// Place the widget area after the header | |
add_action ('__after_header', 'add_my_widget_area', 10); | |
function add_my_widget_area() { | |
if ( tc__f('__is_home') && function_exists('dynamic_sidebar') ) { | |
?> | |
<div class="my-extra-widget-area <?php echo current_filter(); ?>"> | |
<?php dynamic_sidebar('extra-header-widget-area'); ?> | |
</div> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment