Changeset 13128 for trunk/wp-content/themes/twentyten/functions.php
- Timestamp:
- 02/14/2010 01:00:22 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-content/themes/twentyten/functions.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyten/functions.php
r13112 r13128 2 2 3 3 // Set the content width based on the Theme CSS 4 $content_width = apply_filters( 'twentyten_content_width', 640 );4 $content_width = apply_filters( 'twentyten_content_width', 640 ); 5 5 6 6 // Your Changeable header business starts here … … 26 26 } 27 27 28 add_custom_image_header( '', 'twentyten_admin_header_style');28 add_custom_image_header( '', 'twentyten_admin_header_style' ); 29 29 // and thus ends the changeable header business 30 30 … … 45 45 $locale_file = TEMPLATEPATH . "/languages/$locale.php"; 46 46 if ( is_readable($locale_file) ) 47 require_once( $locale_file);47 require_once( $locale_file ); 48 48 49 49 // Get the page number 50 function get_page_number() {50 function twentyten_get_page_number() { 51 51 if ( get_query_var('paged') ) 52 echo ' | ' . __( 'Page ' , 'twentyten' ) . get_query_var('paged');52 echo ' | ' . __( 'Page ' , 'twentyten' ) . get_query_var('paged'); 53 53 } 54 54 55 55 // Control excerpt length 56 function new_excerpt_length($length) {56 function twentyten_new_excerpt_length( $length ) { 57 57 return 40; 58 58 } 59 add_filter( 'excerpt_length', 'new_excerpt_length');59 add_filter( 'excerpt_length', 'twentyten_new_excerpt_length' ); 60 60 61 61 62 62 // Make a nice read more link on excerpts 63 function new_excerpt_more($more) {63 function twentyten_new_excerpt_more($more) { 64 64 return ' … <a href="'. get_permalink() . '">' . 'Continue reading <span class="meta-nav">→</span>' . '</a>'; 65 65 } 66 add_filter( 'excerpt_more', 'new_excerpt_more');66 add_filter( 'excerpt_more', 'twentyten_new_excerpt_more' ); 67 67 68 68 69 69 // Template for comments and pingbacks 70 function twentyten_ comment($comment, $args, $depth) {71 $GLOBALS ['comment'] = $comment; ?>72 <?php if ( '' == $comment->comment_type) { ?>73 <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">70 function twentyten_list_comment( $comment, $args, $depth ) { 71 $GLOBALS['comment'] = $comment; ?> 72 <?php if ( '' == $comment->comment_type ) { ?> 73 <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> 74 74 <div id="comment-<?php comment_ID(); ?>"> 75 75 <div class="comment-author vcard"> 76 <?php echo get_avatar($comment, 40); ?> 77 78 <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?> 76 <?php echo get_avatar( $comment, 40 ); ?> 77 <?php printf( __('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link() ); ?> 79 78 </div> 80 <?php if ( $comment->comment_approved == '0') : ?>81 <em><?php _e( 'Your comment is awaiting moderation.')?></em>79 <?php if ( $comment->comment_approved == '0' ) : ?> 80 <em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em> 82 81 <br /> 83 82 <?php endif; ?> 84 83 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'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','')?></div>86 87 <div class="comment-body"><?php comment_text() ?></div>84 <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()); ?></a><?php edit_comment_link(__('(Edit)', 'twentyten'),' ',''); ?></div> 85 86 <div class="comment-body"><?php comment_text(); ?></div> 88 87 89 88 <div class="reply"> 90 <?php comment_reply_link( array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'])))?>89 <?php comment_reply_link( array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'])) ); ?> 91 90 </div> 92 91 </div> … … 94 93 <?php } else { ?> 95 94 <li class="post pingback"> 96 <p><?php _e( 'Pingback:') ?> <?php comment_author_link ()?><?php edit_comment_link ( 'edit', ' ', '' ); ?></p>95 <p><?php _e( 'Pingback: ', 'twentyten' ); ?><?php comment_author_link(); ?><?php edit_comment_link ( __('edit', 'twentyten'), ' ', '' ); ?></p> 97 96 <?php } 98 97 } 99 98 100 99 // Make the Visual Editor styles match the theme's styles 101 function my_editor_style($url) { 102 if ( !empty($url) ) 103 $url .= ','; 104 100 function twentyten_my_editor_style( $url ) { 101 if ( !empty($url) ) 102 $url .= ','; 105 103 // Change the path here if using sub-directory 106 104 $url .= trailingslashit( get_stylesheet_directory_uri() ) . 'editor-style.css'; … … 108 106 return $url; 109 107 } 110 add_filter('mce_css', 'my_editor_style'); 108 add_filter( 'mce_css', 'twentyten_my_editor_style' ); 109 111 110 112 111 // Remove inline styles on gallery shortcode 113 function remove_gallery_css() {112 function twentyten_remove_gallery_css() { 114 113 return "<div class='gallery'>"; 115 114 } 116 add_filter('gallery_style', 'remove_gallery_css'); 115 add_filter( 'gallery_style', 'twentyten_remove_gallery_css' ); 116 117 117 118 118 // For category lists on category archives: Returns other categories except the current one (redundant) 119 function cats_meow( $glue) {119 function cats_meow( $glue ) { 120 120 $current_cat = single_cat_title( '', false ); 121 121 $separator = "\n"; … … 123 123 foreach ( $cats as $i => $str ) { 124 124 if ( strstr( $str, ">$current_cat<" ) ) { 125 unset( $cats[$i]);125 unset( $cats[$i] ); 126 126 break; 127 127 } … … 130 130 return false; 131 131 132 return trim( join( $glue, $cats ));132 return trim( join( $glue, $cats ) ); 133 133 } // end cats_meow 134 134 135 135 136 // For tag lists on tag archives: Returns other tags except the current one (redundant) 136 function tag_ur_it( $glue) {137 function tag_ur_it( $glue ) { 137 138 $current_tag = single_tag_title( '', '', false ); 138 139 $separator = "\n"; … … 140 141 foreach ( $tags as $i => $str ) { 141 142 if ( strstr( $str, ">$current_tag<" ) ) { 142 unset( $tags[$i]);143 unset( $tags[$i] ); 143 144 break; 144 145 } … … 147 148 return false; 148 149 149 return trim( join( $glue, $tags ));150 return trim( join( $glue, $tags ) ); 150 151 } // end tag_ur_it 151 152 152 153 // Register widgetized areas 153 function t heme_widgets_init() {154 function twentyten_widgets_init() { 154 155 // Area 1 155 register_sidebar( array (156 register_sidebar( array( 156 157 'name' => 'Primary Widget Area', 157 158 'id' => 'primary-widget-area', 158 'description' => __( 'The primary widget area' , 'twentyten'),159 'description' => __( 'The primary widget area' , 'twentyten' ), 159 160 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 160 161 'after_widget' => "</li>", … … 164 165 165 166 // Area 2 166 register_sidebar( array (167 register_sidebar( array( 167 168 'name' => 'Secondary Widget Area', 168 169 'id' => 'secondary-widget-area', 169 'description' => __( 'The secondary widget area' , 'twentyten'),170 'description' => __( 'The secondary widget area' , 'twentyten' ), 170 171 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 171 172 'after_widget' => "</li>", … … 175 176 176 177 // Area 3 177 register_sidebar( array (178 register_sidebar( array( 178 179 'name' => 'First Footer Widget Area', 179 180 'id' => 'first-footer-widget-area', 180 'description' => __( 'The first footer widget area' , 'twentyten'),181 'description' => __( 'The first footer widget area' , 'twentyten' ), 181 182 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 182 183 'after_widget' => "</li>", … … 186 187 187 188 // Area 4 188 register_sidebar( array (189 register_sidebar( array( 189 190 'name' => 'Second Footer Widget Area', 190 191 'id' => 'second-footer-widget-area', 191 'description' => __( 'The second footer widget area' , 'twentyten'),192 'description' => __( 'The second footer widget area' , 'twentyten' ), 192 193 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 193 194 'after_widget' => "</li>", … … 197 198 198 199 // Area 5 199 register_sidebar( array (200 register_sidebar( array( 200 201 'name' => 'Third Footer Widget Area', 201 202 'id' => 'third-footer-widget-area', 202 'description' => __( 'The third footer widget area' , 'twentyten'),203 'description' => __( 'The third footer widget area' , 'twentyten' ), 203 204 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 204 205 'after_widget' => "</li>", … … 208 209 209 210 // Area 6 210 register_sidebar( array (211 register_sidebar( array( 211 212 'name' => 'Fourth Footer Widget Area', 212 213 'id' => 'fourth-footer-widget-area', 213 'description' => __( 'The fourth footer widget area' , 'twentyten'),214 'description' => __( 'The fourth footer widget area' , 'twentyten' ), 214 215 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 215 216 'after_widget' => "</li>", … … 221 222 222 223 // Add all the groovy widget areas 223 add_action( 'init', 't heme_widgets_init' );224 add_action( 'init', 'twentyten_widgets_init' );
Note: See TracChangeset
for help on using the changeset viewer.