Ticket #13751: 13751.2.diff
| File 13751.2.diff, 9.3 KB (added by nacin, 3 years ago) |
|---|
-
wp-includes/theme.php
1535 1535 function _custom_background_cb() { 1536 1536 $background = get_background_image(); 1537 1537 $color = get_background_color(); 1538 if ( ! $background && !$color )1538 if ( ! $background && ! $color ) 1539 1539 return; 1540 1540 1541 switch ( get_theme_mod('background_repeat', 'repeat') ) { 1542 case 'no-repeat': 1543 $repeat = 'background-repeat: no-repeat;'; 1544 break; 1545 case 'repeat-x': 1546 $repeat = 'background-repeat: repeat-x;'; 1547 break; 1548 case 'repeat-y': 1549 $repeat = 'background-repeat: repeat-y;'; 1550 break; 1551 default: 1552 $repeat = 'background-repeat: repeat;'; 1553 } 1541 $style = $color ? "background-color: #$color;" : ''; 1554 1542 1555 switch ( get_theme_mod('background_position_x', 'left') ) { 1556 case 'center': 1557 $position = 'background-position: top center;'; 1558 break; 1559 case 'right': 1560 $position = 'background-position: top right;'; 1561 break; 1562 default: 1563 $position = 'background-position: top left;'; 1564 } 1543 if ( $background ) { 1544 $image = " background-image: url('$background');"; 1565 1545 1566 if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') ) 1567 $attachment = 'background-attachment: scroll;'; 1568 else 1569 $attachment = 'background-attachment: fixed;'; 1546 $repeat = get_theme_mod( 'background_repeat', 'repeat' ); 1547 if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) 1548 $repeat = 'repeat'; 1549 $repeat = " background-repeat: $repeat;"; 1550 1551 $position = get_theme_mod( 'background_position_x', 'left' ); 1552 if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) 1553 $position = 'left'; 1554 $position = " background-position: top $position;"; 1555 1556 $attachment = get_theme_mod( 'background_attachment', 'scroll' ); 1557 if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) 1558 $attachment = 'scroll'; 1559 $attachment = " background-attachment: $attachment;"; 1570 1560 1571 if ( !empty($background ) ) 1572 $image = "background-image: url('$background');"; 1573 else 1574 $image = ''; 1575 1576 if ( !empty($color) ) 1577 $color = "background-color: #$color;"; 1578 else 1579 $color = ''; 1561 $style .= $image . $repeat . $position . $attachment; 1562 } 1580 1563 ?> 1581 1564 <style type="text/css"> 1582 body { 1583 <?php echo $image; ?> 1584 <?php echo $color; ?> 1585 <?php echo $repeat; ?> 1586 <?php echo $position; ?> 1587 <?php echo $attachment; ?> 1588 } 1565 body { <?php echo trim( $style ); ?> } 1589 1566 </style> 1590 1567 <?php 1591 1568 } -
wp-content/themes/twentyten/functions.php
190 190 <style type="text/css"> 191 191 /* Shows the same border as on front end */ 192 192 #headimg { 193 border-bottom: 1px solid #000 000;194 border-top: 4px solid #000 000;193 border-bottom: 1px solid #000; 194 border-top: 4px solid #000; 195 195 } 196 197 /* If NO_HEADER_TEXT is false, you can style here the header text preview */ 198 #headimg #name { 199 } 200 201 #headimg #desc { 202 } 196 /* If NO_HEADER_TEXT is false, you would style the text with these selectors: 197 #headimg #name { } 198 #headimg #desc { } 199 */ 203 200 </style> 204 201 <?php 205 202 } 206 203 endif; 207 204 208 if ( ! function_exists( 'twentyten_the_page_number' ) ) :209 205 /** 210 * Prints the page number currently being browsed, with a vertical bar before it.206 * Makes some changes to the <title> tag, by filtering the output of wp_title(). 211 207 * 212 * Used in Twenty Ten's header.php to add the page number to the <title> HTML tag. 208 * If we have a site description and we're viewing the home page or a blog posts 209 * page (when using a static front page), then we will add the site description. 213 210 * 211 * If we're viewing a search result, then we're going to recreate the title entirely. 212 * We're going to add page numbers to all titles as well, to the middle of a search 213 * result title and the end of all other titles. 214 * 215 * The site title also gets added to all titles. 216 * 214 217 * @since Twenty Ten 1.0 218 * 219 * @param string $title Title generated by wp_title() 220 * @param string $separator The separator passed to wp_title(). Twenty Ten uses a 221 * vertical bar, "|", as a separator in header.php. 222 * @return string The new title, ready for the <title> tag. 215 223 */ 216 function twentyten_the_page_number() { 217 global $paged; // Contains page number. 218 if ( $paged >= 2 ) 219 echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), $paged ); 224 function twentyten_filter_wp_title( $title, $separator ) { 225 // The $paged global variable contains the page number of a listing of posts. 226 // The $page global variable contains the page number of a single post that is paged. 227 // We'll display whichever one applies, if we're not looking at the first page. 228 global $paged, $page; 229 230 if ( is_search() ) { 231 // If we're a search, let's start over: 232 $title = sprintf( __( 'Search results for %s', 'twentyten' ), '"' . get_search_query() . '"' ); 233 // Add a page number if we're on page 2 or more: 234 if ( $paged >= 2 ) 235 $title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), $paged ); 236 // Add the site name to the end: 237 $title .= " $separator " . get_bloginfo( 'name', 'display' ); 238 // We're done. Let's send the new title back to wp_title(): 239 return $title; 240 } 241 242 // Otherwise, let's start by adding the site name to the end: 243 $title .= get_bloginfo( 'name', 'display' ); 244 245 // If we have a site description and we're on the home/front page, add the description: 246 $site_description = get_bloginfo( 'description', 'display' ); 247 if ( $site_description && ( is_home() || is_front_page() ) ) 248 $title .= " $separator " . $site_description; 249 250 // Add a page number if necessary: 251 if ( $paged >= 2 || $page >= 2 ) 252 $title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ); 253 254 // Return the new title to wp_title(): 255 return $title; 220 256 } 221 endif;257 add_filter( 'wp_title', 'twentyten_filter_wp_title', 10, 2 ); 222 258 223 259 /** 224 260 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. -
wp-content/themes/twentyten/header.php
11 11 ?><!DOCTYPE html> 12 12 <html <?php language_attributes(); ?>> 13 13 <head> 14 <meta charset="<?php bloginfo( 'charset' ); ?>" /> 15 <title> 16 <?php // Returns the title based on what is being viewed 17 if ( is_single() ) { // single posts 18 single_post_title(); echo ' | '; bloginfo( 'name' ); 19 // The home page or, if using a static front page, the blog posts page. 20 } elseif ( is_home() || is_front_page() ) { 21 bloginfo( 'name' ); 22 if( get_bloginfo( 'description' ) ) 23 echo ' | ' ; bloginfo( 'description' ); 24 twentyten_the_page_number(); 25 } elseif ( is_page() ) { // WordPress Pages 26 single_post_title( '' ); echo ' | '; bloginfo( 'name' ); 27 } elseif ( is_search() ) { // Search results 28 printf( __( 'Search results for %s', 'twentyten' ), '"'.get_search_query().'"' ); twentyten_the_page_number(); echo ' | '; bloginfo( 'name' ); 29 } elseif ( is_404() ) { // 404 (Not Found) 30 _e( 'Not Found', 'twentyten' ); echo ' | '; bloginfo( 'name' ); 31 } else { // Otherwise: 32 wp_title( '' ); echo ' | '; bloginfo( 'name' ); twentyten_the_page_number(); 33 } 34 ?> 35 </title> 36 <link rel="profile" href="http://gmpg.org/xfn/11" /> 37 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> 38 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 14 <meta charset="<?php bloginfo( 'charset' ); ?>" /> 15 <title><?php 16 /* 17 * Print the <title> tag based on what is being viewed. 18 * We filter the output of wp_title() a bit -- see 19 * twentyten_filter_wp_title() in functions.php. 20 */ 21 wp_title( '|', true, 'right' ); 22 23 ?></title> 24 <link rel="profile" href="http://gmpg.org/xfn/11" /> 25 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> 26 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 39 27 <?php 40 28 /* We add some JavaScript to pages with the comment form 41 29 * to support sites with threaded comments (when in use). … … 48 36 * generally use this hook to add elements to <head> such 49 37 * as styles, scripts, and meta tags. 50 38 */ 51 52 39 wp_head(); 53 40 ?> 54 41 </head> -
wp-admin/custom-background.php
281 281 <th scope="row"><?php _e( 'Attachment' ); ?></th> 282 282 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend> 283 283 <label> 284 <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', ' fixed')); ?> />284 <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'scroll')); ?> /> 285 285 <?php _e('Scroll') ?> 286 286 </label> 287 287 <label> 288 <input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', ' fixed')); ?> />288 <input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'scroll')); ?> /> 289 289 <?php _e('Fixed') ?> 290 290 </label> 291 291 </fieldset></td>