Posted By

fouroclockproject on 07/02/09


Tagged

wordpress thesiswp


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

yinzer
nickreese
joelhaus
fabi
naeemnur
tmbrenneke


Widgetize Header, Footer and Everything Else Using Thesis' Hooks


 / Published in: PHP
 

URL: http://www.fouroclockproject.com

Adds two "sidebars" to the header. You can drag and drop widgets into them just like any other sidebar from your WP dashboard. You can change the Hook to move the "sidebars" somewhere else on the page. For example, change 'thesishookheader' to 'thesishookafter_html' and your new sidebars will show up there. Style using CSS to change their layout.

  1. if ( function_exists('register_sidebar') )
  2. register_sidebar(array(
  3. 'name' => 'Header Sidebar 3',
  4. 'before_widget' => '<li>',
  5. 'after_widget' => '</li>',
  6. 'before_title' => '<h3>',
  7. 'after_title' => '</h3>',
  8. ));
  9.  
  10. if ( function_exists('register_sidebar') )
  11. register_sidebar(array(
  12. 'name' => 'Header Sidebar 4',
  13. 'before_widget' => '<li>',
  14. 'after_widget' => '</li>',
  15. 'before_title' => '<h3>',
  16. 'after_title' => '</h3>',
  17. ));
  18.  
  19. function widget_header() { ?>
  20.  
  21. <div class="sidebar_3">
  22. <ul class="sidebar_list">
  23. <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Sidebar 3') ) { ?>
  24. <li class="widget">
  25. <div class="widget_box">
  26. <h3><?php _e('Header Sidebar 3', 'thesis'); ?></h3>
  27. <p>This is your new sidebar. You can add widgets to it like normal using the Widgets Panel.</p>
  28. </div>
  29. </li>
  30. <?php } ?>
  31. </ul>
  32. </div>
  33.  
  34.  
  35. <div class="sidebar_4">
  36. <ul class="sidebar_list">
  37. <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Sidebar 4') ) { ?>
  38. <li class="widget">
  39. <div class="widget_box">
  40. <h3><?php _e('Header Sidebar 4', 'thesis'); ?></h3>
  41. <p>This is your new sidebar. You can add widgets to it like normal using the Widgets Panel.</p>
  42. </div>
  43. </li>
  44. <?php } ?>
  45. </ul>
  46. </div>
  47.  
  48. <?php
  49. }
  50. add_action('thesis_hook_header', 'widget_header');

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: paulbright on November 25, 2009

Hello,

Thanks for the Great code...

Question... Can we make it so it only applies to the Home Page?

Thank You,

Paul :)

You need to login to post a comment.