PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/blog/wp-content/themes/k2/functions.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 118 lines | 86 code | 17 blank | 15 comment | 6 complexity | 1f50bb4dc94f93f31db7b1317be45bbc MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. $themecolors = array(
  3. 'bg' => 'ffffff',
  4. 'text' => '444444',
  5. 'link' => '2277dd'
  6. );
  7. $content_width = 500;
  8. add_theme_support( 'automatic-feed-links' );
  9. add_custom_background();
  10. /* Current version of K2 */
  11. $current = '0.9.1';
  12. // Sidebar registration for dynamic sidebars
  13. if(function_exists('register_sidebar')) {
  14. register_sidebar(array('before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>'));
  15. }
  16. define('HEADER_TEXTCOLOR', 'ffffff');
  17. define('HEADER_IMAGE', '%s/images/k2-header.png'); // %s is theme dir uri
  18. define('HEADER_IMAGE_WIDTH', 780);
  19. define('HEADER_IMAGE_HEIGHT', 200);
  20. function k2_admin_header_style() {
  21. ?>
  22. <style type="text/css">
  23. #headimg {
  24. height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
  25. width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
  26. background-color: rgb(51, 113, 163);
  27. }
  28. #headimg h1
  29. {
  30. font-family: 'Trebuchet MS',Verdana,Sans-Serif;
  31. font-size: 30px;
  32. font-weight: bold;
  33. letter-spacing: -1px;
  34. padding-left: 40px;
  35. padding-right: 40px;
  36. padding-top: 75px;
  37. margin: 0;
  38. }
  39. #headimg h1 a {
  40. color:#<?php header_textcolor() ?>;
  41. border: none;
  42. text-decoration: none;
  43. }
  44. #headimg a:hover
  45. {
  46. text-decoration:underline;
  47. }
  48. #headimg #desc
  49. {
  50. font-weight:normal;
  51. font-size:10px;
  52. color:#<?php header_textcolor() ?>;
  53. margin:0;
  54. padding:0 40px;
  55. }
  56. <?php if ( 'blank' == get_header_textcolor() ) { ?>
  57. #headerimg h1, #headerimg #desc {
  58. display: none;
  59. }
  60. #headimg h1 a, #headimg #desc {
  61. color:#<?php echo HEADER_TEXTCOLOR ?>;
  62. }
  63. <?php } ?>
  64. </style>
  65. <?php
  66. }
  67. function header_style() {
  68. ?>
  69. <style type="text/css">
  70. #header {
  71. background:#3371a3 url(<?php header_image() ?>) center repeat-y;
  72. }
  73. <?php if ( 'blank' == get_header_textcolor() ) { ?>
  74. #header h1 a, #header .description {
  75. display: none;
  76. }
  77. <?php } else { ?>
  78. #header h1 a, #header h1 a:hover, #header .description {
  79. color: #<?php header_textcolor() ?>;
  80. }
  81. <?php } ?>
  82. </style>
  83. <?php
  84. }
  85. add_custom_image_header('header_style', 'k2_admin_header_style');
  86. // Register nav menu locations
  87. register_nav_menus( array(
  88. 'primary' => __( 'Primary Navigation' ),
  89. ) );
  90. // Add a home link to the default menu fallback wp_page_menu
  91. function k2_page_menu_args( $args ) {
  92. $args['show_home'] = 'Blog';
  93. $args['depth'] = 1;
  94. return $args;
  95. }
  96. add_filter( 'wp_page_menu_args', 'k2_page_menu_args' );
  97. // Add CLASS attribute of "menu" to the first <ul> occurence in wp_page_menu( )
  98. function k2_add_menu_class( $menu ) {
  99. return preg_replace( '/<ul>/', '<ul id="nav" class="menu">', $menu, 1 );
  100. }
  101. add_filter( 'wp_page_menu', 'k2_add_menu_class' );