Advertisement
lion_neel

Function Reference/ register sidebar

Jun 15th, 2013
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.61 KB | None | 0 0
  1. */ Description
  2. =================*/
  3.  
  4. Builds the definition for sidebars and returns the ID. Call on "widgets_init" action.
  5.  
  6. */ Usage
  7. =================*/
  8.  
  9. <?php register_sidebar( $args ); ?>      /* For Single Sidebar */
  10.  
  11. <?php register_sidebars( $number, $args ); ?>     /* For Multiple Sidebar */
  12.  
  13.  
  14. */ Default  Usage For Single Sidebar
  15. =====================================*/
  16.  
  17. <?php $args = array(
  18.     'name'          => __( 'Sidebar name', 'theme_text_domain' ),
  19.     'id'            => 'unique-sidebar-id',
  20.     'description'   => '',
  21.         'class'         => '',
  22.     'before_widget' => '<li id="%1$s" class="widget %2$s">',
  23.     'after_widget'  => '</li>',
  24.     'before_title'  => '<h2 class="widgettitle">',
  25.     'after_title'   => '</h2>' ); ?>
  26.  
  27.  
  28. */ Calling The Sidebar
  29. =======================*/
  30.  
  31. <?php dynamic_sidebar( '__name__' ); ?>
  32.  
  33.  
  34. */  Parameters Descriptions
  35. ===============================*/
  36.  
  37.   args
  38.        (string/array) (optional) Builds Sidebar based off of 'name' and 'id' values.
  39.  
  40.        # Default: None
  41.  
  42.        * name - Sidebar name (default is localized 'Sidebar' and numeric ID).
  43.  
  44.        * id - Sidebar id - Must be all in lowercase, with no spaces (default is a numeric auto-incremented ID).
  45.  
  46.        * description - Text description of what/where the sidebar is. Shown on widget management screen.
  47.  
  48.        * class - CSS class name to assign to the widget HTML
  49.  
  50.        * before_widget - HTML to place before every widget
  51.  
  52.        * after_widget - HTML to place after every widget
  53.  
  54.        * before_title - HTML to place before every title
  55.  
  56.        * after_title - HTML to place after every title
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement