Skip to content

Instantly share code, notes, and snippets.

@mscharl
Last active December 22, 2015 02:08
Show Gist options
  • Save mscharl/6400684 to your computer and use it in GitHub Desktop.
Save mscharl/6400684 to your computer and use it in GitHub Desktop.
Wordpress Dynamic Sidebar
<?php
if(function_exists('register_sidebar')) {
register_sidebar(array(
'before_widget' => '<div id="%1$s" class="block %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
?>
<div id="about-me" class="block">
<h3>Über mich</h3>
<p>Hi, ich bin …</p>
</div>
<div id="contact-me" class="block">
<h3>Kontakt</h3>
<p>Nachrichten kannst du …</p>
</div>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<!-- Standard-Sidebar, wenn keine Widgets vorhanden sind -->
<div id="about-me" class="block">
<h3>Über mich</h3>
<p>Hi, ich bin …</p>
</div>
<div id="contact-me" class="block">
<h3>Kontakt</h3>
<p>Nachrichten …</p>
</div>
<?php endif; ?>
<!-- zusätzliche statische Sidebar-Elemente -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment