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

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

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 227 lines | 173 code | 20 blank | 34 comment | 14 complexity | b18ca0cee68d955292cebceeafcf08bb MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Enterprise
  5. */
  6. $themecolors = array(
  7. 'bg' => 'f0f0f0',
  8. 'border' => 'cccccc',
  9. 'text' => '555555',
  10. 'link' => '008DCF',
  11. 'url' => '008DCF'
  12. );
  13. $content_width = 630; // pixels
  14. // Register Enterprise nav menus
  15. register_nav_menus( array(
  16. 'primary' => __( 'Primary Menu', 'enterprise' ),
  17. 'secondary' => __( 'Secondary Menu', 'enterprise' ),
  18. ) );
  19. // Get our fallback menu to show a home link
  20. function enterprise_page_menu_args($args) {
  21. $args['show_home'] = true;
  22. return $args;
  23. }
  24. add_filter('wp_page_menu_args', 'enterprise_page_menu_args');
  25. // A custom fallback for the Secondary nav menu
  26. // that display the 10 most popular categories
  27. function enterprise_secondary_cat_menu() { ?>
  28. <div class="menu">
  29. <ul>
  30. <?php wp_list_categories( 'title_li=&orderby=count&number=10&order=DESC' ); ?>
  31. </ul>
  32. </div>
  33. <?php }
  34. load_theme_textdomain('enterprise', TEMPLATEPATH.'/languages/');
  35. // Add default posts and comments RSS feed links to head
  36. add_theme_support( 'automatic-feed-links' );
  37. // Define widget areas
  38. register_sidebar(array(
  39. 'name'=> __( 'Sidebar', 'enterprise' ),
  40. 'description' => __( 'This is the main sidebar.', 'enterprise' ),
  41. 'before_title'=>'<h4>',
  42. 'after_title'=>'</h4>',
  43. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  44. 'after_widget' => "</div>"
  45. ));
  46. register_sidebar(array(
  47. 'name'=> __( 'Footer #1', 'enterprise' ),
  48. 'description' => __( 'This is the left column in the footer.', 'enterprise'),
  49. 'before_title'=>'<h4>',
  50. 'after_title'=>'</h4>',
  51. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  52. 'after_widget' => "</div>"
  53. ));
  54. register_sidebar(array(
  55. 'name'=> __( 'Footer #2', 'enterprise' ),
  56. 'description' => __( 'This is the middle column in the footer.', ''),
  57. 'before_title'=>'<h4>',
  58. 'after_title'=>'</h4>',
  59. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  60. 'after_widget' => "</div>"
  61. ));
  62. register_sidebar(array(
  63. 'name'=> __( 'Footer #3', 'enterprise' ),
  64. 'description' => __( 'This is the right column in the footer.', 'enterprise' ),
  65. 'before_title'=>'<h4>',
  66. 'after_title'=>'</h4>',
  67. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  68. 'after_widget' => "</div>"
  69. ));
  70. // Template for comments and pingbacks
  71. if ( ! function_exists( 'studiopress_comment' ) ) :
  72. function studiopress_comment( $comment, $args, $depth ) {
  73. $GLOBALS ['comment'] = $comment; ?>
  74. <?php if ( '' == $comment->comment_type ) : ?>
  75. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  76. <div id="comment-<?php comment_ID(); ?>">
  77. <div class="comment-author vcard">
  78. <?php echo get_avatar( $comment, 40 ); ?>
  79. <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>', 'enterprise' ), get_comment_author_link() ); ?>
  80. </div>
  81. <?php if ( $comment->comment_approved == '0' ) : ?>
  82. <em><?php _e( 'Your comment is awaiting moderation.', 'enterprise' ); ?></em>
  83. <br />
  84. <?php endif; ?>
  85. <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s at %2$s', 'enterprise' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'enterprise' ),' ','' ); ?></div>
  86. <div class="comment-body"><?php comment_text(); ?></div>
  87. <div class="reply">
  88. <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  89. </div>
  90. </div>
  91. <?php else : ?>
  92. <li class="post pingback">
  93. <p><?php _e( 'Pingback: ', 'enterprise' ); ?><?php comment_author_link(); ?><?php edit_comment_link ( __('edit', 'enterprise'), '&nbsp;&nbsp;', '' ); ?></p>
  94. <?php endif;
  95. }
  96. endif;
  97. // Add support for WP 3.0 custom background
  98. add_custom_background();
  99. // Provide custom header
  100. // Set some default values
  101. define('HEADER_TEXTCOLOR', '333333'); // Default text color
  102. define('HEADER_IMAGE_WIDTH', 960); // Default image width is actually the div's height
  103. define('HEADER_IMAGE_HEIGHT', 80); // Same for height
  104. function header_style() {
  105. // This function defines the style for the theme
  106. // You can change these selectors to match your theme
  107. ?>
  108. <style type="text/css">
  109. #header {
  110. background: #FFFFFF url(<?php header_image() ?>) no-repeat;
  111. }
  112. <?php
  113. // Has the text been hidden?
  114. // If so, set display to equal none
  115. if ( 'blank' == get_header_textcolor() ) { ?>
  116. .header-left {
  117. padding: 0;
  118. width: auto;
  119. }
  120. #header h1,
  121. #header h4 {
  122. text-indent: -9000px;
  123. margin: 0;
  124. padding: 0;
  125. }
  126. #header h1 a,
  127. #header h4 a {
  128. display: block;
  129. margin: 0;
  130. width: 960px;
  131. height: 80px;
  132. }
  133. p#description {
  134. display: none;
  135. }
  136. <?php } else {
  137. // Otherwise, set the color to be the user selected one
  138. ?>
  139. #header h1, #header h1 a, #header h1 a:visited, #header h4, #header h4 a, #header h4 a:visited, .header-left {
  140. color: #<?php header_textcolor(); ?>;
  141. }
  142. <?php } ?>
  143. </style>
  144. <?php
  145. }
  146. function enterprise_admin_header_style() {
  147. ?>
  148. <style type="text/css">
  149. #headimg {
  150. background: #FFFFFF url(<?php header_image() ?>) no-repeat;
  151. border: 1px solid #E4E4E4;
  152. -moz-border-radius: 0 0 10px 10px;
  153. -khtml-border-radius: 0 0 10px 10px;
  154. -webkit-border-radius: 0 0 10px 10px;
  155. border-radius: 0 0 10px 10px;
  156. overflow: hidden;
  157. padding: 0;
  158. width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
  159. height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
  160. }
  161. #headimg h1 {
  162. font: 24px/20px Tahoma,Arial,Verdana;
  163. font-weight: normal;
  164. margin: 0 0 7px;
  165. font-weight: normal;
  166. padding: 15px 0 0 20px;
  167. width: 690px;
  168. }
  169. #headimg, #headimg h1 a {
  170. color: #<?php header_textcolor(); ?>;
  171. text-decoration: none;
  172. }
  173. #headimg #desc {
  174. font-family:Tahoma,Arial,Verdana;
  175. font-size:14px;
  176. font-style:italic;
  177. margin: 0 0 0 20px;
  178. }
  179. <?php if ( 'blank' == get_header_textcolor() ) { ?>
  180. #header h1 a {
  181. display: none;
  182. }
  183. #header, #header h1 a {
  184. color: <?php echo HEADER_TEXTCOLOR ?>;
  185. }
  186. <?php } ?>
  187. </style>
  188. <?php
  189. }
  190. add_custom_image_header('header_style', 'enterprise_admin_header_style');
  191. /**
  192. * Get the URL of the next image in a gallery for attachment pages
  193. */
  194. function theme_get_next_attachment_url() {
  195. global $post;
  196. $post = get_post($post);
  197. $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
  198. foreach ( $attachments as $k => $attachment ) {
  199. if ( $attachment->ID == $post->ID )
  200. break;
  201. }
  202. $k++;
  203. if ( isset( $attachments[ $k ] ) )
  204. return get_attachment_link( $attachments[ $k ]->ID );
  205. else
  206. return get_permalink( $post->post_parent );
  207. }