Ticket #11512: add_editor_style.2.diff
File add_editor_style.2.diff, 1.6 KB (added by , 14 years ago) |
---|
-
theme.php
1447 1447 } 1448 1448 1449 1449 /** 1450 * Add callback for a custom TinyMCE editor stylesheet.1450 * Add callback for custom TinyMCE editor stylesheets. 1451 1451 * 1452 1452 * The parameter $stylesheet is the name of the stylesheet, relative to 1453 * the theme root. It is optional and defaults to 'editor-style.css'. 1453 * the theme root. It also accepts an array of stylesheets. 1454 * It is optional and defaults to 'editor-style.css'. 1454 1455 * 1455 1456 * @since 3.0.0 1456 1457 * 1457 * @param callback $stylesheet Name of stylesheet relative to theme root. 1458 * @param mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root. 1459 * Defaults to 'editor-style.css' 1458 1460 */ 1459 1461 function add_editor_style( $stylesheet = 'editor-style.css' ) { 1460 if ( isset( $GLOBALS['editor_style'] ) )1461 return;1462 1462 1463 1463 add_theme_support( 'editor-style' ); 1464 1464 1465 1465 if ( ! is_admin() ) 1466 1466 return; 1467 1467 1468 $GLOBALS['editor_style'] = $stylesheet; 1468 global $editor_style; 1469 $stylesheet = (array) $stylesheet; 1470 foreach ( $stylesheet as $k => $v ) { 1471 $stylesheet[$k] = get_stylesheet_directory_uri() . "/$v"; 1472 } 1473 $editor_style = array_merge( (array) $editor_style, $stylesheet ); 1469 1474 add_filter( 'mce_css', '_editor_style_cb' ); 1470 1475 } 1471 1476 1472 1477 /** 1473 * Callback for custom editor stylesheet .1478 * Callback for custom editor stylesheet support. 1474 1479 * 1475 1480 * @since 3.0.0 1476 1481 * @see add_editor_style() … … 1480 1485 global $editor_style; 1481 1486 if ( ! empty( $url ) ) 1482 1487 $url .= ','; 1483 return $url . get_stylesheet_directory_uri() . "/$editor_style";1488 return $url . implode( ',', $editor_style ); 1484 1489 } 1485 1490 1486 1491 /**