Skip to content

Instantly share code, notes, and snippets.

@ingozoell
Created December 15, 2016 15:20
Show Gist options
  • Save ingozoell/32017b4f6efa3a06f637a720bdbc6b51 to your computer and use it in GitHub Desktop.
Save ingozoell/32017b4f6efa3a06f637a720bdbc6b51 to your computer and use it in GitHub Desktop.
WordPress Widget
function shop_widgets() {
register_sidebar( array(
'name' => 'Shop – Footer 1',
'id' => 'shop-footer-1',
'before_widget' => '<div id="%1$s" class="cb-footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="cb-footer-widget-title"><span>',
'after_title' => '</span></h3>'
) );
register_sidebar( array(
'name' => 'Shop – Footer 2',
'id' => 'shop-footer-2',
'before_widget' => '<div id="%1$s" class="cb-footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="cb-footer-widget-title"><span>',
'after_title' => '</span></h3>'
) );
register_sidebar( array(
'name' => 'Shop – Footer 3',
'id' => 'shop-footer-3',
'before_widget' => '<div id="%1$s" class="cb-footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="cb-footer-widget-title"><span>',
'after_title' => '</span></h3>'
) );
register_sidebar( array(
'name' => 'Shop – Footer 4',
'id' => 'shop-footer-4',
'before_widget' => '<div id="%1$s" class="cb-footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="cb-footer-widget-title"><span>',
'after_title' => '</span></h3>'
) );
}
add_action( 'widgets_init', 'shop_widgets' );
/* TEMPLATE */
<?php if ( is_active_sidebar( 'shop-footer-1' ) ) : ?>
<div class="cb-one cb-column clearfix">
<?php dynamic_sidebar('shop-footer-1'); ?>
</div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'shop-footer-4' ) ) : ?>
<div class="zahlungsmethoden cb-one cb-column clearfix">
<?php dynamic_sidebar('shop-footer-4'); ?>
</div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'shop-footer-2' ) ) : ?>
<div class="cb-one cb-column clearfix">
<?php dynamic_sidebar('shop-footer-2'); ?>
</div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'shop-footer-3' ) ) : ?>
<div class="cb-one cb-column clearfix">
<?php dynamic_sidebar('shop-footer-3'); ?>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment