PageRenderTime 50ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/lgorence/quickpress
PHP | 49 lines | 14 code | 8 blank | 27 comment | 4 complexity | e12981688db9b5d9e2693f83d2e4c947 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. /**
  3. * The menus functions deal with registering nav menus within WordPress for the core framework. Theme
  4. * developers may use the default menu(s) provided by the framework within their own themes, decide not
  5. * to use them, or register additional menus.
  6. *
  7. * @package HybridCore
  8. * @subpackage Functions
  9. * @author Justin Tadlock <justin@justintadlock.com>
  10. * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
  11. * @link http://themehybrid.com/hybrid-core
  12. * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  13. */
  14. /* Register nav menus. */
  15. add_action( 'init', 'hybrid_register_menus' );
  16. /**
  17. * Registers the the framework's default menus based on the menus the theme has registered support for.
  18. *
  19. * @since 0.8.0
  20. * @access private
  21. * @uses register_nav_menu() Registers a nav menu with WordPress.
  22. * @link http://codex.wordpress.org/Function_Reference/register_nav_menu
  23. * @return void
  24. */
  25. function hybrid_register_menus() {
  26. /* Get theme-supported menus. */
  27. $menus = get_theme_support( 'hybrid-core-menus' );
  28. /* If there is no array of menus IDs, return. */
  29. if ( !is_array( $menus[0] ) )
  30. return;
  31. /* Register the 'primary' menu. */
  32. if ( in_array( 'primary', $menus[0] ) )
  33. register_nav_menu( 'primary', _x( 'Primary', 'nav menu location', 'hybrid-core' ) );
  34. /* Register the 'secondary' menu. */
  35. if ( in_array( 'secondary', $menus[0] ) )
  36. register_nav_menu( 'secondary', _x( 'Secondary', 'nav menu location', 'hybrid-core' ) );
  37. /* Register the 'subsidiary' menu. */
  38. if ( in_array( 'subsidiary', $menus[0] ) )
  39. register_nav_menu( 'subsidiary', _x( 'Subsidiary', 'nav menu location', 'hybrid-core' ) );
  40. }
  41. ?>