Ticket #9015: 9015.functions_cleanup.2.diff
File 9015.functions_cleanup.2.diff, 20.1 KB (added by , 15 years ago) |
---|
-
wp-content/themes/twentyten/functions.php
1 1 <?php 2 2 3 3 // Set the content width based on the Theme CSS 4 $content_width = apply_filters( 'twentyten_content_width', 640 ); 4 if ( ! isset( $content_width ) ) 5 $content_width = 640; 5 6 6 // Your Changeable header business starts here 7 // No CSS, just IMG call 8 define( 'HEADER_TEXTCOLOR', ''); 9 define( 'HEADER_IMAGE', '%s/images/header-1.jpg'); // %s is theme dir uri 10 define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) ); 11 define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) ); 12 define( 'NO_HEADER_TEXT', true ); 7 if ( ! function_exists( 'twentyten_init' ) ) : 8 function twentyten_init() { 9 // Your Changeable header business starts here 10 // No CSS, just IMG call 11 define( 'HEADER_TEXTCOLOR', ''); 12 define( 'HEADER_IMAGE', '%s/images/header-1.jpg'); // %s is theme dir uri 13 define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) ); 14 define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) ); 15 define( 'NO_HEADER_TEXT', true ); 13 16 17 add_custom_image_header( '', 'twentyten_admin_header_style' ); 18 // and thus ends the changeable header business 19 20 add_custom_background(); 21 22 // This theme needs post thumbnails 23 add_theme_support( 'post-thumbnails' ); 24 25 // We'll be using them for custom header images on posts and pages 26 // so we want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit) 27 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); 28 29 // Add default posts and comments RSS feed links to head. 30 automatic_feed_links(); 31 32 // Make theme available for translation 33 // Translations can be filed in the /languages/ directory 34 load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' ); 35 36 $locale = get_locale(); 37 $locale_file = TEMPLATEPATH . "/languages/$locale.php"; 38 if ( is_readable( $locale_file ) ) 39 require_once( $locale_file ); 40 } 41 endif; 42 add_action( 'init', 'twentyten_init' ); 43 44 if ( ! function_exists( 'twentyten_admin_header_style' ) ) : 14 45 function twentyten_admin_header_style() { 15 46 ?> 16 47 <style type="text/css"> … … 24 55 </style> 25 56 <?php 26 57 } 58 endif; 27 59 28 add_custom_image_header( '', 'twentyten_admin_header_style' );29 // and thus ends the changeable header business30 31 add_custom_background();32 33 // This theme needs post thumbnails34 add_theme_support( 'post-thumbnails' );35 36 // We'll be using them for custom header images on posts and pages37 // so we want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit)38 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );39 40 // Add default posts and comments RSS feed links to head.41 automatic_feed_links();42 43 // Make theme available for translation44 // Translations can be filed in the /languages/ directory45 load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' );46 47 $locale = get_locale();48 $locale_file = TEMPLATEPATH . "/languages/$locale.php";49 if ( is_readable($locale_file) )50 require_once( $locale_file );51 52 60 // Get the page number 53 function twentyten_get_page_number() { 61 if ( ! function_exists( 'get_page_number' ) ) : 62 function get_page_number() { 54 63 if ( get_query_var('paged') ) 55 echo ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');64 return ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged'); 56 65 } 66 endif; 57 67 68 // Echo the page number 69 if ( ! function_exists( 'the_page_number' ) ) : 70 function the_page_number() { 71 echo get_page_number(); 72 } 73 endif; 74 58 75 // Control excerpt length 59 function twentyten_new_excerpt_length( $length ) { 76 if ( ! function_exists( 'twentyten_excerpt_length' ) ) : 77 function twentyten_excerpt_length( $length ) { 60 78 return 40; 61 79 } 62 add_filter( 'excerpt_length', 'twentyten_new_excerpt_length' ); 80 endif; 81 add_filter( 'excerpt_length', 'twentyten_excerpt_length' ); 63 82 64 83 65 84 // Make a nice read more link on excerpts 66 function twentyten_new_excerpt_more($more) { 85 if ( ! function_exists( 'twentyten_excerpt_more' ) ) : 86 function twentyten_excerpt_more($more) { 67 87 return ' … <a href="'. get_permalink() . '">' . 'Continue reading <span class="meta-nav">→</span>' . '</a>'; 68 88 } 69 add_filter( 'excerpt_more', 'twentyten_new_excerpt_more' ); 89 endif; 90 add_filter( 'excerpt_more', 'twentyten_excerpt_more' ); 70 91 71 92 72 93 // Template for comments and pingbacks 73 function twentyten_list_comment( $comment, $args, $depth ) { 74 $GLOBALS['comment'] = $comment; ?> 75 <?php if ( '' == $comment->comment_type ) { ?> 94 if ( ! function_exists( 'twentyten_comment' ) ) : 95 function twentyten_comment( $comment, $args, $depth ) { 96 $GLOBALS ['comment'] = $comment; ?> 97 <?php if ( '' == $comment->comment_type ) : ?> 76 98 <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> 77 99 <div id="comment-<?php comment_ID(); ?>"> 78 100 <div class="comment-author vcard"> 79 101 <?php echo get_avatar( $comment, 40 ); ?> 80 <?php printf( __('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link() ); ?> 102 103 <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?> 81 104 </div> 82 105 <?php if ( $comment->comment_approved == '0' ) : ?> 83 <em><?php _e( 'Your comment is awaiting moderation.' , 'twentyten'); ?></em>106 <em><?php _e( 'Your comment is awaiting moderation.' ); ?></em> 84 107 <br /> 85 108 <?php endif; ?> 86 109 87 <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>110 <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> 88 111 89 112 <div class="comment-body"><?php comment_text(); ?></div> 90 113 91 114 <div class="reply"> 92 <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'])) ); ?>115 <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> 93 116 </div> 94 117 </div> 95 118 96 <?php } else {?>119 <?php else : ?> 97 120 <li class="post pingback"> 98 <p><?php _e( 'Pingback: ', 'twentyten' ); ?><?php comment_author_link(); ?><?php edit_comment_link ( __('edit', 'twentyten'), ' ', '' ); ?></p>99 <?php }121 <p><?php _e( 'Pingback:' ); ?> <?php comment_author_link (); ?><?php edit_comment_link( 'edit', ' ', '' ); ?></p> 122 <?php endif; 100 123 } 124 endif; 101 125 102 126 // Make the Visual Editor styles match the theme's styles 103 function twentyten_my_editor_style( $url ) { 104 if ( !empty($url) ) 127 if ( ! function_exists( 'twentyten_editor_style' ) ) : 128 function twentyten_editor_style( $url ) { 129 if ( ! empty( $url ) ) 105 130 $url .= ','; 106 131 107 132 // Change the path here if using sub-directory … … 109 134 110 135 return $url; 111 136 } 112 add_filter( 'mce_css', 'twentyten_my_editor_style' ); 137 endif; 138 add_filter( 'mce_css', 'twentyten_editor_style' ); 113 139 114 115 140 // Remove inline styles on gallery shortcode 141 if ( ! function_exists( 'twentyten_remove_gallery_css' ) ) : 116 142 function twentyten_remove_gallery_css() { 117 return " <div class='gallery'>";143 return "\t\t<div class='gallery'>\n\t\t"; 118 144 } 145 endif; 119 146 add_filter( 'gallery_style', 'twentyten_remove_gallery_css' ); 120 147 148 if ( ! function_exists( 'twentyten_cat_list' ) ) : 121 149 function twentyten_cat_list() { 122 150 return twentyten_term_list('category', ', ', __('Posted in %s', 'twentyten'), __('Also posted in %s', 'twentyten') ); 123 151 } 152 endif; 153 154 if ( ! function_exists( 'twentyten_tag_list' ) ) : 124 155 function twentyten_tag_list() { 125 156 return twentyten_term_list('post_tag', ', ', __('Tagged %s', 'twentyten'), __('Also tagged %s', 'twentyten') ); 126 157 } 158 endif; 159 160 if ( ! function_exists( 'twentyten_term_list' ) ) : 127 161 function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '') { 128 162 global $wp_query, $post; 129 163 $current_term = $wp_query->get_queried_object(); … … 149 183 return sprintf($text, join($glue, $tlist)); 150 184 return ''; 151 185 } 186 endif; 152 187 153 188 // Register widgetized areas 189 if ( ! function_exists( 'twentyten_widgets_init' ) ) : 154 190 function twentyten_widgets_init() { 155 191 // Area 1 156 register_sidebar( array (192 register_sidebar( array ( 157 193 'name' => 'Primary Widget Area', 158 194 'id' => 'primary-widget-area', 159 195 'description' => __( 'The primary widget area' , 'twentyten' ), … … 164 200 ) ); 165 201 166 202 // Area 2 167 register_sidebar( array (203 register_sidebar( array ( 168 204 'name' => 'Secondary Widget Area', 169 205 'id' => 'secondary-widget-area', 170 206 'description' => __( 'The secondary widget area' , 'twentyten' ), … … 175 211 ) ); 176 212 177 213 // Area 3 178 register_sidebar( array (214 register_sidebar( array ( 179 215 'name' => 'First Footer Widget Area', 180 216 'id' => 'first-footer-widget-area', 181 217 'description' => __( 'The first footer widget area' , 'twentyten' ), … … 186 222 ) ); 187 223 188 224 // Area 4 189 register_sidebar( array (225 register_sidebar( array ( 190 226 'name' => 'Second Footer Widget Area', 191 227 'id' => 'second-footer-widget-area', 192 228 'description' => __( 'The second footer widget area' , 'twentyten' ), … … 197 233 ) ); 198 234 199 235 // Area 5 200 register_sidebar( array (236 register_sidebar( array ( 201 237 'name' => 'Third Footer Widget Area', 202 238 'id' => 'third-footer-widget-area', 203 239 'description' => __( 'The third footer widget area' , 'twentyten' ), … … 208 244 ) ); 209 245 210 246 // Area 6 211 register_sidebar( array (247 register_sidebar( array ( 212 248 'name' => 'Fourth Footer Widget Area', 213 249 'id' => 'fourth-footer-widget-area', 214 250 'description' => __( 'The fourth footer widget area' , 'twentyten' ), … … 218 254 'after_title' => '</h3>', 219 255 ) ); 220 256 221 } // end theme_widgets_init 222 223 // Add all the groovy widget areas 257 } 258 endif; 224 259 add_action( 'init', 'twentyten_widgets_init' ); -
wp-content/themes/twentyten/header.php
5 5 if ( is_single() ) { 6 6 single_post_title(); echo ' | '; bloginfo('name'); 7 7 } elseif ( is_home() || is_front_page() ) { 8 bloginfo('name'); echo ' | '; bloginfo('description'); t wentyten_get_page_number();8 bloginfo('name'); echo ' | '; bloginfo('description'); the_page_number(); 9 9 } elseif ( is_page() ) { 10 10 single_post_title(''); echo ' | '; bloginfo('name'); 11 11 } elseif ( is_search() ) { 12 printf(__('Search results for "%s"', 'twentyten'), esc_html($s)); t wentyten_get_page_number(); echo ' | '; bloginfo('name');12 printf(__('Search results for "%s"', 'twentyten'), esc_html($s)); the_page_number(); echo ' | '; bloginfo('name'); 13 13 } elseif ( is_404() ) { 14 14 _e('Not Found', 'twentyten'); echo ' | '; bloginfo('name'); 15 15 } else { 16 wp_title(''); echo ' | '; bloginfo('name'); t wentyten_get_page_number();16 wp_title(''); echo ' | '; bloginfo('name'); the_page_number(); 17 17 } 18 18 ?></title> 19 19 … … 24 24 <link rel="stylesheet" type="text/css" media="print" href="<?php bloginfo('stylesheet_directory'); ?>/print.css" /> 25 25 26 26 <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> 27 27 28 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 29 28 30 <?php wp_head(); ?> 29 31 </head> 30 32 … … 35 37 <div id="masthead"> 36 38 37 39 <div id="branding"> 38 <div id="site-title"><span><a href="<?php echo home_url('/'); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' );?></a></span></div>39 <div id="site-description"><?php bloginfo( 'description' ) ;?></div>40 <div id="site-title"><span><a href="<?php bloginfo( 'url' ) ?>/" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ) ?></a></span></div> 41 <div id="site-description"><?php bloginfo( 'description' ) ?></div> 40 42 41 43 <?php 42 if ( is_singular() && has_post_thumbnail( $post->ID ) ) { 43 echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 44 } else { ?> 44 global $post; 45 if ( is_singular() && has_post_thumbnail( $post->ID ) ) { 46 echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 47 } else { ?> 45 48 <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /> 46 49 <?php } ?> 47 50 </div><!-- #branding --> 48 51 49 52 <div id="access"> 50 <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ) ; ?>"><?php _e( 'Skip to content', 'twentyten' );?></a></div>53 <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ) ?>"><?php _e( 'Skip to content', 'twentyten' ) ?></a></div> 51 54 <?php wp_page_menu( 'sort_column=menu_order' ); ?> 52 55 </div><!-- #access --> 53 56 -
wp-content/themes/twentyten/attachment.php
5 5 6 6 <?php the_post(); ?> 7 7 8 <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent); ?>" title="<?php printf( esc_attr__( 'Return to %s', 'twentyten' ), esc_html( get_the_title($post->post_parent), 1 ) ); ?>" rel="gallery">← <?php echo get_the_title($post->post_parent);?></a></p>8 <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ) ?>" title="<?php printf( esc_attr__( 'Return to %s', 'twentyten' ), esc_html( get_the_title( $post->post_parent ), 1 ) ) ?>" rel="gallery">← <?php echo get_the_title( $post->post_parent ) ?></a></p> 9 9 10 10 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 11 11 <h2 class="entry-title"><?php the_title(); ?></h2> … … 13 13 <div class="entry-meta"> 14 14 <span class="meta-prep meta-prep-author"><?php _e( 'By ', 'twentyten' ); ?></span> 15 15 <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span> 16 <span class="meta-sep"> <?php _e( ' | ', 'twentyten' ); ?></span>17 <span class="meta-prep meta-prep-entry-date"><?php _e( 'Published ', 'twentyten'); ?></span>18 <span class="entry-date"><abbr class="published" title="<?php the_time( ) ?>"><?php echo get_the_date(); ?></abbr></span>19 <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ;?>16 <span class="meta-sep"> | </span> 17 <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'twentyten'); ?></span> 18 <span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php echo get_the_date(); ?></abbr></span> 19 <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?> 20 20 </div><!-- .entry-meta --> 21 21 22 22 <div class="entry-content"> 23 23 <div class="entry-attachment"> 24 <?php if ( wp_attachment_is_image() ) : ?>25 <p class="attachment"><a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php26 echo wp_get_attachment_image( $post->ID, array($content_width, $content_width) ); // max $content_width wide or high.27 24 <?php if ( wp_attachment_is_image( $post->ID ) ) : ?> 25 <p class="attachment"><a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php 26 echo wp_get_attachment_image( $post->ID, array( $content_width, $content_width ) ); // max $content_width wide or high. 27 ?></a></p> 28 28 29 <div id="nav-below" class="navigation"> 30 <div class="nav-previous"><?php previous_image_link( false ); ?></div> 31 <div class="nav-next"><?php next_image_link( false ); ?></div> 32 </div><!-- #nav-below --> 33 <?php else : ?> 34 <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename(get_permalink()); ?></a> 35 <?php endif; ?> 29 30 <div id="nav-below" class="navigation"> 31 <div class="nav-previous"><?php previous_image_link( false ); ?></div> 32 <div class="nav-next"><?php next_image_link( false ); ?></div> 33 </div><!-- #nav-below --> 34 <?php else : ?> 35 <a href="<?php echo wp_get_attachment_url( $post->ID ) ?>" title="<?php echo esc_attr( get_the_title( $post->ID ) ); ?>" rel="attachment"><?php echo basename( get_permalink() ) ?></a> 36 <?php endif; ?> 36 37 </div> 37 <div class="entry-caption"><?php if ( ! empty($post->post_excerpt) ) the_excerpt();?></div>38 <div class="entry-caption"><?php if ( ! empty( $post->post_excerpt ) ) the_excerpt() ?></div> 38 39 39 40 <?php wp_link_pages( 'before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>' );?>40 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?> 41 <?php wp_link_pages( 'before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>' ) ?> 41 42 42 43 </div><!-- .entry-content --> 43 44 … … 47 48 get_the_tag_list( __( ' and tagged ', 'twentyten' ), ', ', '' ), 48 49 get_permalink(), 49 50 the_title_attribute('echo=0'), 50 get_post_comments_feed_link() ) ;?>51 get_post_comments_feed_link() ) ?> 51 52 52 53 <?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?> 53 <?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyten' ), get_trackback_url() ) ;?>54 <?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyten' ), get_trackback_url() ) ?> 54 55 <?php elseif ( !comments_open() && pings_open() ) : // Only trackbacks open ?> 55 <?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyten' ), get_trackback_url() ) ;?>56 <?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyten' ), get_trackback_url() ) ?> 56 57 <?php elseif ( comments_open() && !pings_open() ) : // Only comments open ?> 57 <?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyten' ) ;?>58 <?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyten' ) ?> 58 59 <?php elseif ( !comments_open() && !pings_open() ) : // Comments and trackbacks closed ?> 59 <?php _e( 'Both comments and trackbacks are currently closed.', 'twentyten' ) ;?>60 <?php _e( 'Both comments and trackbacks are currently closed.', 'twentyten' ) ?> 60 61 <?php endif; ?> 61 <?php edit_post_link( __( 'Edit', 'twentyten' ), "\n\t\t\t\t\t<span class=\"edit-link\">", "</span>" ) ;?>62 <?php edit_post_link( __( 'Edit', 'twentyten' ), "\n\t\t\t\t\t<span class=\"edit-link\">", "</span>" ) ?> 62 63 </div><!-- .entry-utility --> 63 64 </div><!-- #post-<?php the_ID(); ?> --> 64 65 … … 68 69 </div><!-- #container --> 69 70 70 71 <?php get_sidebar(); ?> 71 <?php get_footer(); ?> 72 No newline at end of file 72 <?php get_footer(); ?>