Advertisement
kobial8

Sidebar Widgets Details

Feb 14th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.06 KB | None | 0 0
  1. /***********************************************************************************************/
  2. /* EELETE ALL SIDEBAR CONTENT AND USE '<?php get_sidebar(); ?>' . THIS WILL LOOK FOR sidebar.php file//
  3. FOR FOOTER SIDE OTHER TWO WIDGET USE: <?php get_sidebar('left-footer'); ?> AND <?php get_sidebar('right-footer'); ?>*/
  4. /***********************************************************************************************/
  5. /***********************************************************************************************/
  6. /* Add Sidebar Support in functions.php as per your html markup */
  7. /***********************************************************************************************/
  8. if (function_exists('register_sidebar')) {
  9.     register_sidebar(
  10.         array(
  11.             'name' => __('Main Sidebar', 'adaptive-framework'),
  12.             'id' => 'main-sidebar',
  13.             'description' => __('The main sidebar area', 'adaptive-framework'),
  14.             'before_widget' => '<div class="sidebar-widget">',
  15.             'after_widget' => '</div> <!-- end sidebar-widget -->',
  16.             'before_title' => '<h4>',
  17.             'after_title' => '</h4>'
  18.         )
  19.     );
  20.     register_sidebar(
  21.         array(
  22.             'name' => __('Left Footer', 'adaptive-framework'),
  23.             'id' => 'left-footer',
  24.             'description' => __('The left footer area', 'adaptive-framework'),
  25.             'before_widget' => '<div class="footer-widget span3">',
  26.             'after_widget' => '</div> <!-- end footer-widget -->',
  27.             'before_title' => '<h5>',
  28.             'after_title' => '</h5>'
  29.         )
  30.     );
  31.     register_sidebar(
  32.         array(
  33.             'name' => __('Right Footer', 'adaptive-framework'),
  34.             'id' => 'right-footer',
  35.             'description' => __('The right footer area', 'adaptive-framework'),
  36.             'before_widget' => '<div class="footer-widget span6">',
  37.             'after_widget' => '</div> <!-- end footer-widget -->',
  38.             'before_title' => '<h5>',
  39.             'after_title' => '</h5>'
  40.         )
  41.     );
  42. }
  43.  
  44. /***********************************************************************************************/
  45. /* CHECK YOUR index.php/template-welcome.php deleted all html sidebar content and used 'get_sidebar()' functions.
  46. This function will look for sidebar.php -- So now create a sidebar.php in the theme directory and use the following code:*/
  47. /***********************************************************************************************/
  48.  
  49. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('main-sidebar')) : ?>
  50.  
  51.     <div class="sidebar-widget">
  52.    
  53.         <h4><?php _e('Search', 'adaptive-framework'); ?></h4>
  54.         <?php get_search_form(); ?>
  55.        
  56.     </div> <!-- end sidebar-widget -->
  57.    
  58. <?php endif; ?>
  59.  
  60. /***********************************************************************************************/
  61. /* LIKE ABOVE, CREATE ANOTHER TWO FILE AS 'sidebar-left-footer.php' AND 'sidebar-right-footer.php'*/
  62. /***********************************************************************************************/
  63. FOR LEFT FOOTER SIDEBAR:
  64. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('left-footer')) : ?> 
  65. <?php endif; ?>
  66.  
  67. FOR RIGHT FOOTER SIDEBAR:
  68. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('right-footer')) : ?>
  69. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement