sabato 26 aprile 2014

WORDPRESS ADD CUSTOM SIDEBAR

add to function.php

<?php
/**
 * Register our sidebars and widgetized areas.
 *
 */
function example_init() {

 register_sidebar( array(
  'name' => 'Custom Sidebar',
  'id' => 'custom-sidebar',
  'before_widget' => '<div>',
  'after_widget' => '</div>',
  'before_title' => '<h2 class="rounded">',
  'after_title' => '</h2>',
 ) );
}
add_action( 'widgets_init', 'example_init' );
?>
 
 
add to template page
 
 
<?php if ( is_active_sidebar( 'left-sidebar' ) ) : ?>
 <ul id="sidebar">
  <?php dynamic_sidebar( 'left-sidebar' ); ?>
 </ul>
<?php endif; ?> 

Nessun commento:

Posta un commento