Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eri-trabiccolo/77f1ffbc56e24131169c to your computer and use it in GitHub Desktop.
Save eri-trabiccolo/77f1ffbc56e24131169c to your computer and use it in GitHub Desktop.
Extra widget area after header in home
// 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