PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/skeleton/sidebar-footer.php

https://github.com/ciaranmahoney/skeleton_wp
PHP | 57 lines | 36 code | 8 blank | 13 comment | 13 complexity | de0e4aca9e65ac1e88f9a5ea2b91b554 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /**
  3. * Footer widget areas.
  4. *
  5. * @package WordPress
  6. * @subpackage skeleton
  7. * @since skeleton 0.1
  8. */
  9. // count the active widgets to determine column sizes
  10. $footerwidgets = is_active_sidebar('first-footer-widget-area') + is_active_sidebar('second-footer-widget-area') + is_active_sidebar('third-footer-widget-area') + is_active_sidebar('fourth-footer-widget-area');
  11. // default
  12. $footergrid = "one_fourth";
  13. // if only one
  14. if ($footerwidgets == "1") {
  15. $footergrid = "full-width";
  16. // if two, split in half
  17. } elseif ($footerwidgets == "2") {
  18. $footergrid = "one_half";
  19. // if three, divide in thirds
  20. } elseif ($footerwidgets == "3") {
  21. $footergrid = "one_third";
  22. // if four, split in fourths
  23. } elseif ($footerwidgets == "4") {
  24. $footergrid = "one_fourth";
  25. }
  26. ?>
  27. <?php if ($footerwidgets) : ?>
  28. <?php if (is_active_sidebar('first-footer-widget-area')) : ?>
  29. <div class="<?php echo $footergrid;?>">
  30. <?php dynamic_sidebar('first-footer-widget-area'); ?>
  31. </div>
  32. <?php endif;?>
  33. <?php if (is_active_sidebar('second-footer-widget-area')) : $last = ($footerwidgets == '2' ? ' last' : false);?>
  34. <div class="<?php echo $footergrid.$last;?>">
  35. <?php dynamic_sidebar('second-footer-widget-area'); ?>
  36. </div>
  37. <?php endif;?>
  38. <?php if (is_active_sidebar('third-footer-widget-area')) : $last = ($footerwidgets == '3' ? ' last' : false);?>
  39. <div class="<?php echo $footergrid.$last;?>">
  40. <?php dynamic_sidebar('third-footer-widget-area'); ?>
  41. </div>
  42. <?php endif;?>
  43. <?php if (is_active_sidebar('fourth-footer-widget-area')) : $last = ($footerwidgets == '4' ? ' last' : false);?>
  44. <div class="<?php echo $footergrid.$last;?>">
  45. <?php dynamic_sidebar('fourth-footer-widget-area'); ?>
  46. </div>
  47. <?php endif;?>
  48. <div class="clear"></div>
  49. <?php endif;?>