PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/news/library/functions/widgets.php

https://bitbucket.org/lgorence/quickpress
PHP | 113 lines | 35 code | 24 blank | 54 comment | 0 complexity | a14339523c5e0fade36adaf77cd19b28 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. /**
  3. * Sets up the core framework's widgets and unregisters some of the default WordPress widgets if the
  4. * theme supports this feature. The framework's widgets are meant to extend the default WordPress
  5. * widgets by giving users highly-customizable widget settings. A theme must register support for the
  6. * 'hybrid-core-widgets' feature to use the framework widgets.
  7. *
  8. * @package HybridCore
  9. * @subpackage Functions
  10. * @author Justin Tadlock <justin@justintadlock.com>
  11. * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
  12. * @link http://themehybrid.com/hybrid-core
  13. * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  14. */
  15. /* Unregister WP widgets. */
  16. add_action( 'widgets_init', 'hybrid_unregister_widgets' );
  17. /* Register Hybrid widgets. */
  18. add_action( 'widgets_init', 'hybrid_register_widgets' );
  19. /**
  20. * Registers the core frameworks widgets. These widgets typically overwrite the equivalent default WordPress
  21. * widget by extending the available options of the widget.
  22. *
  23. * @since 0.6.0
  24. * @access private
  25. * @uses register_widget() Registers individual widgets with WordPress
  26. * @link http://codex.wordpress.org/Function_Reference/register_widget
  27. * @return void
  28. */
  29. function hybrid_register_widgets() {
  30. /* Load the archives widget class. */
  31. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-archives.php' );
  32. /* Load the authors widget class. */
  33. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-authors.php' );
  34. /* Load the bookmarks widget class. */
  35. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-bookmarks.php' );
  36. /* Load the calendar widget class. */
  37. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-calendar.php' );
  38. /* Load the categories widget class. */
  39. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-categories.php' );
  40. /* Load the nav menu widget class. */
  41. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-nav-menu.php' );
  42. /* Load the pages widget class. */
  43. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-pages.php' );
  44. /* Load the search widget class. */
  45. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-search.php' );
  46. /* Load the tags widget class. */
  47. require_once( trailingslashit( HYBRID_CLASSES ) . 'widget-tags.php' );
  48. /* Register the archives widget. */
  49. register_widget( 'Hybrid_Widget_Archives' );
  50. /* Register the authors widget. */
  51. register_widget( 'Hybrid_Widget_Authors' );
  52. /* Register the bookmarks widget. */
  53. register_widget( 'Hybrid_Widget_Bookmarks' );
  54. /* Register the calendar widget. */
  55. register_widget( 'Hybrid_Widget_Calendar' );
  56. /* Register the categories widget. */
  57. register_widget( 'Hybrid_Widget_Categories' );
  58. /* Register the nav menu widget. */
  59. register_widget( 'Hybrid_Widget_Nav_Menu' );
  60. /* Register the pages widget. */
  61. register_widget( 'Hybrid_Widget_Pages' );
  62. /* Register the search widget. */
  63. register_widget( 'Hybrid_Widget_Search' );
  64. /* Register the tags widget. */
  65. register_widget( 'Hybrid_Widget_Tags' );
  66. }
  67. /**
  68. * Unregister default WordPress widgets that are replaced by the framework's widgets. Widgets that
  69. * aren't replaced by the framework widgets are not unregistered.
  70. *
  71. * @since 0.3.2
  72. * @access private
  73. * @uses unregister_widget() Unregisters a registered widget.
  74. * @link http://codex.wordpress.org/Function_Reference/unregister_widget
  75. * @return void
  76. */
  77. function hybrid_unregister_widgets() {
  78. /* Unregister the default WordPress widgets. */
  79. unregister_widget( 'WP_Widget_Archives' );
  80. unregister_widget( 'WP_Widget_Calendar' );
  81. unregister_widget( 'WP_Widget_Categories' );
  82. unregister_widget( 'WP_Widget_Links' );
  83. unregister_widget( 'WP_Nav_Menu_Widget' );
  84. unregister_widget( 'WP_Widget_Pages' );
  85. unregister_widget( 'WP_Widget_Recent_Posts' );
  86. unregister_widget( 'WP_Widget_Search' );
  87. unregister_widget( 'WP_Widget_Tag_Cloud' );
  88. }
  89. ?>