Changeset 39185 for trunk/src/wp-includes/theme.php
- Timestamp:
- 11/09/2016 08:42:22 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r39181 r39185 1575 1575 1576 1576 /** 1577 * Fetch the saved Custom CSS content. 1578 * 1579 * Gets the content of a Custom CSS post that matches the 1580 * current theme. 1577 * Fetch the `custom_css` post for a given theme. 1581 1578 * 1582 1579 * @since 4.7.0 … … 1584 1581 * 1585 1582 * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme. 1586 * 1587 * @return string The Custom CSS Post content. 1588 */ 1589 function wp_get_custom_css( $stylesheet = '' ) { 1590 $css = ''; 1591 1583 * @return WP_Post|null The custom_css post or null if none exists. 1584 */ 1585 function wp_get_custom_css_post( $stylesheet = '' ) { 1592 1586 if ( empty( $stylesheet ) ) { 1593 1587 $stylesheet = get_stylesheet(); … … 1595 1589 1596 1590 $custom_css_query_vars = array( 1597 'post_type' => 'custom_css',1598 'post_status' => get_post_stati(),1599 'name' => sanitize_title( $stylesheet ),1600 'number' => 1,1601 'no_found_rows' => true,1602 'cache_results' => true,1591 'post_type' => 'custom_css', 1592 'post_status' => get_post_stati(), 1593 'name' => sanitize_title( $stylesheet ), 1594 'number' => 1, 1595 'no_found_rows' => true, 1596 'cache_results' => true, 1603 1597 'update_post_meta_cache' => false, 1604 1598 'update_term_meta_cache' => false, … … 1608 1602 if ( get_stylesheet() === $stylesheet ) { 1609 1603 $post_id = get_theme_mod( 'custom_css_post_id' ); 1610 if ( ! $post_id ) {1604 if ( ! $post_id || ! get_post( $post_id ) ) { 1611 1605 $query = new WP_Query( $custom_css_query_vars ); 1612 1606 $post = $query->post; 1613 1614 1607 /* 1615 1608 * Cache the lookup. See WP_Customize_Custom_CSS_Setting::update(). … … 1625 1618 } 1626 1619 1620 return $post; 1621 } 1622 1623 /** 1624 * Fetch the saved Custom CSS content. 1625 * 1626 * @since 4.7.0 1627 * @access public 1628 * 1629 * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme. 1630 * @return string The Custom CSS Post content. 1631 */ 1632 function wp_get_custom_css( $stylesheet = '' ) { 1633 $css = ''; 1634 1635 if ( empty( $stylesheet ) ) { 1636 $stylesheet = get_stylesheet(); 1637 } 1638 1639 $post = wp_get_custom_css_post( $stylesheet ); 1627 1640 if ( $post ) { 1628 1641 $css = $post->post_content;
Note: See TracChangeset
for help on using the changeset viewer.