PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/WP960gs-master/functions.php

https://github.com/racs182/Cloud_hosting_pagoda
PHP | 209 lines | 167 code | 29 blank | 13 comment | 15 complexity | 4a4cb7deb43837cfa06ece4be95edd0f MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, AGPL-1.0
  1. <?php
  2. if ( ! isset( $content_width ) ) $content_width = 680;
  3. add_action( 'after_setup_theme', 'twentyten_setup' );
  4. if ( ! function_exists( 'twentyten_setup' ) ):
  5. function twentyten_setup() {
  6. add_editor_style();
  7. // add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
  8. add_theme_support( 'post-thumbnails' );
  9. /*
  10. add_image_size('max-thumbnail',640,250,true);
  11. add_image_size('thumbnail-200-100',200,100,true);
  12. */
  13. add_theme_support( 'automatic-feed-links' );
  14. load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
  15. $locale = get_locale();
  16. $locale_file = get_template_directory() . "/languages/$locale.php";
  17. if ( is_readable( $locale_file ) )
  18. require_once( $locale_file );
  19. // This theme uses wp_nav_menu() in one location.
  20. register_nav_menus( array(
  21. 'primary' => __( 'Primary Navigation', 'twentyten' ),
  22. 'footer-menu' => __( 'Footer Navigation' , 'twentyten')
  23. ) );
  24. }
  25. endif;
  26. if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
  27. function twentyten_admin_header_style() {
  28. ?>
  29. <style type="text/css">
  30. #headimg {
  31. border-bottom: 1px solid #000;
  32. border-top: 4px solid #000;
  33. }
  34. </style>
  35. <?php
  36. }
  37. endif;
  38. function twentyten_page_menu_args( $args ) {
  39. $args['show_home'] = true;
  40. return $args;
  41. }
  42. add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
  43. function twentyten_excerpt_length( $length ) {
  44. return 40;
  45. }
  46. add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
  47. function twentyten_continue_reading_link() {
  48. return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
  49. }
  50. function twentyten_auto_excerpt_more( $more ) {
  51. return ' &hellip;' . twentyten_continue_reading_link();
  52. }
  53. add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
  54. function twentyten_custom_excerpt_more( $output ) {
  55. if ( has_excerpt() && ! is_attachment() ) {
  56. $output .= twentyten_continue_reading_link();
  57. }
  58. return $output;
  59. }
  60. add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
  61. add_filter( 'use_default_gallery_style', '__return_false' );
  62. function twentyten_remove_gallery_css( $css ) {
  63. return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
  64. }
  65. if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
  66. add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
  67. if ( ! function_exists( 'twentyten_comment' ) ) :
  68. function twentyten_comment( $comment, $args, $depth ) {
  69. $GLOBALS['comment'] = $comment;
  70. switch ( $comment->comment_type ) :
  71. case '' :
  72. ?>
  73. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  74. <div id="comment-<?php comment_ID(); ?>">
  75. <div class="comment-author vcard">
  76. <?php echo get_avatar( $comment, 40 ); ?>
  77. <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  78. </div><!-- .comment-author .vcard -->
  79. <?php if ( $comment->comment_approved == '0' ) : ?>
  80. <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
  81. <br />
  82. <?php endif; ?>
  83. <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  84. <?php
  85. /* translators: 1: date, 2: time */
  86. printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
  87. ?>
  88. </div><!-- .comment-meta .commentmetadata -->
  89. <div class="comment-body"><?php comment_text(); ?></div>
  90. <div class="reply">
  91. <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  92. </div><!-- .reply -->
  93. </div><!-- #comment-## -->
  94. <?php
  95. break;
  96. case 'pingback' :
  97. case 'trackback' :
  98. ?>
  99. <li class="post pingback">
  100. <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
  101. <?php
  102. break;
  103. endswitch;
  104. }
  105. endif;
  106. function twentyten_widgets_init() {
  107. // Area 1, located at the top of the sidebar.
  108. register_sidebar( array(
  109. 'name' => __( 'Primary Widget Area', 'twentyten' ),
  110. 'id' => 'primary-widget-area',
  111. 'description' => __( 'The primary widget area', 'twentyten' ),
  112. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  113. 'after_widget' => '</li>',
  114. 'before_title' => '<h3 class="widget-title">',
  115. 'after_title' => '</h3>',
  116. ) );
  117. // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
  118. register_sidebar( array(
  119. 'name' => __( 'Secondary Widget Area', 'twentyten' ),
  120. 'id' => 'secondary-widget-area',
  121. 'description' => __( 'The secondary widget area', 'twentyten' ),
  122. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  123. 'after_widget' => '</li>',
  124. 'before_title' => '<h3 class="widget-title">',
  125. 'after_title' => '</h3>',
  126. ) );
  127. // Area 3, located in the footer. Empty by default.
  128. register_sidebar( array(
  129. 'name' => __( 'Footer Widget Area', 'twentyten' ),
  130. 'id' => 'first-footer-widget-area',
  131. 'description' => __( 'The first footer widget area', 'twentyten' ),
  132. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  133. 'after_widget' => '</li>',
  134. 'before_title' => '<h3 class="widget-title">',
  135. 'after_title' => '</h3>',
  136. ) );
  137. }
  138. add_action( 'widgets_init', 'twentyten_widgets_init' );
  139. function twentyten_remove_recent_comments_style() {
  140. add_filter( 'show_recent_comments_widget_style', '__return_false' );
  141. }
  142. add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
  143. if ( ! function_exists( 'twentyten_posted_on' ) ) :
  144. function twentyten_posted_on() {
  145. printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
  146. 'meta-prep meta-prep-author',
  147. sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
  148. get_permalink(),
  149. esc_attr( get_the_time() ),
  150. get_the_date()
  151. ),
  152. sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  153. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  154. esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
  155. get_the_author()
  156. )
  157. );
  158. }
  159. endif;
  160. if ( ! function_exists( 'twentyten_posted_in' ) ) :
  161. function twentyten_posted_in() {
  162. // Retrieves tag list of current post, separated by commas.
  163. $tag_list = get_the_tag_list( '', ', ' );
  164. if ( $tag_list ) {
  165. $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
  166. } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
  167. $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
  168. } else {
  169. $posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
  170. }
  171. // Prints the string, replacing the placeholders.
  172. printf(
  173. $posted_in,
  174. get_the_category_list( ', ' ),
  175. $tag_list,
  176. get_permalink(),
  177. the_title_attribute( 'echo=0' )
  178. );
  179. }
  180. endif;