Edit File by line
/home/zeestwma/ceyloniy.../wp-inclu...
File: theme.php
if ( $image ) {
[1500] Fix | Delete
echo esc_url( $image );
[1501] Fix | Delete
}
[1502] Fix | Delete
}
[1503] Fix | Delete
[1504] Fix | Delete
/**
[1505] Fix | Delete
* Gets the header images uploaded for the active theme.
[1506] Fix | Delete
*
[1507] Fix | Delete
* @since 3.2.0
[1508] Fix | Delete
*
[1509] Fix | Delete
* @return array
[1510] Fix | Delete
*/
[1511] Fix | Delete
function get_uploaded_header_images() {
[1512] Fix | Delete
$header_images = array();
[1513] Fix | Delete
[1514] Fix | Delete
$headers = get_posts(
[1515] Fix | Delete
array(
[1516] Fix | Delete
'post_type' => 'attachment',
[1517] Fix | Delete
'meta_key' => '_wp_attachment_is_custom_header',
[1518] Fix | Delete
'meta_value' => get_option( 'stylesheet' ),
[1519] Fix | Delete
'orderby' => 'none',
[1520] Fix | Delete
'nopaging' => true,
[1521] Fix | Delete
)
[1522] Fix | Delete
);
[1523] Fix | Delete
[1524] Fix | Delete
if ( empty( $headers ) ) {
[1525] Fix | Delete
return array();
[1526] Fix | Delete
}
[1527] Fix | Delete
[1528] Fix | Delete
foreach ( (array) $headers as $header ) {
[1529] Fix | Delete
$url = sanitize_url( wp_get_attachment_url( $header->ID ) );
[1530] Fix | Delete
$header_data = wp_get_attachment_metadata( $header->ID );
[1531] Fix | Delete
$header_index = $header->ID;
[1532] Fix | Delete
[1533] Fix | Delete
$header_images[ $header_index ] = array();
[1534] Fix | Delete
$header_images[ $header_index ]['attachment_id'] = $header->ID;
[1535] Fix | Delete
$header_images[ $header_index ]['url'] = $url;
[1536] Fix | Delete
$header_images[ $header_index ]['thumbnail_url'] = $url;
[1537] Fix | Delete
$header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
[1538] Fix | Delete
[1539] Fix | Delete
if ( isset( $header_data['attachment_parent'] ) ) {
[1540] Fix | Delete
$header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'];
[1541] Fix | Delete
} else {
[1542] Fix | Delete
$header_images[ $header_index ]['attachment_parent'] = '';
[1543] Fix | Delete
}
[1544] Fix | Delete
[1545] Fix | Delete
if ( isset( $header_data['width'] ) ) {
[1546] Fix | Delete
$header_images[ $header_index ]['width'] = $header_data['width'];
[1547] Fix | Delete
}
[1548] Fix | Delete
if ( isset( $header_data['height'] ) ) {
[1549] Fix | Delete
$header_images[ $header_index ]['height'] = $header_data['height'];
[1550] Fix | Delete
}
[1551] Fix | Delete
}
[1552] Fix | Delete
[1553] Fix | Delete
return $header_images;
[1554] Fix | Delete
}
[1555] Fix | Delete
[1556] Fix | Delete
/**
[1557] Fix | Delete
* Gets the header image data.
[1558] Fix | Delete
*
[1559] Fix | Delete
* @since 3.4.0
[1560] Fix | Delete
*
[1561] Fix | Delete
* @global array $_wp_default_headers
[1562] Fix | Delete
*
[1563] Fix | Delete
* @return object
[1564] Fix | Delete
*/
[1565] Fix | Delete
function get_custom_header() {
[1566] Fix | Delete
global $_wp_default_headers;
[1567] Fix | Delete
[1568] Fix | Delete
if ( is_random_header_image() ) {
[1569] Fix | Delete
$data = _get_random_header_data();
[1570] Fix | Delete
} else {
[1571] Fix | Delete
$data = get_theme_mod( 'header_image_data' );
[1572] Fix | Delete
if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
[1573] Fix | Delete
$directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
[1574] Fix | Delete
$data = array();
[1575] Fix | Delete
$data['url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
[1576] Fix | Delete
$data['thumbnail_url'] = $data['url'];
[1577] Fix | Delete
if ( ! empty( $_wp_default_headers ) ) {
[1578] Fix | Delete
foreach ( (array) $_wp_default_headers as $default_header ) {
[1579] Fix | Delete
$url = vsprintf( $default_header['url'], $directory_args );
[1580] Fix | Delete
if ( $data['url'] === $url ) {
[1581] Fix | Delete
$data = $default_header;
[1582] Fix | Delete
$data['url'] = $url;
[1583] Fix | Delete
$data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
[1584] Fix | Delete
break;
[1585] Fix | Delete
}
[1586] Fix | Delete
}
[1587] Fix | Delete
}
[1588] Fix | Delete
}
[1589] Fix | Delete
}
[1590] Fix | Delete
[1591] Fix | Delete
$default = array(
[1592] Fix | Delete
'url' => '',
[1593] Fix | Delete
'thumbnail_url' => '',
[1594] Fix | Delete
'width' => get_theme_support( 'custom-header', 'width' ),
[1595] Fix | Delete
'height' => get_theme_support( 'custom-header', 'height' ),
[1596] Fix | Delete
'video' => get_theme_support( 'custom-header', 'video' ),
[1597] Fix | Delete
);
[1598] Fix | Delete
return (object) wp_parse_args( $data, $default );
[1599] Fix | Delete
}
[1600] Fix | Delete
[1601] Fix | Delete
/**
[1602] Fix | Delete
* Registers a selection of default headers to be displayed by the custom header admin UI.
[1603] Fix | Delete
*
[1604] Fix | Delete
* @since 3.0.0
[1605] Fix | Delete
*
[1606] Fix | Delete
* @global array $_wp_default_headers
[1607] Fix | Delete
*
[1608] Fix | Delete
* @param array $headers Array of headers keyed by a string ID. The IDs point to arrays
[1609] Fix | Delete
* containing 'url', 'thumbnail_url', and 'description' keys.
[1610] Fix | Delete
*/
[1611] Fix | Delete
function register_default_headers( $headers ) {
[1612] Fix | Delete
global $_wp_default_headers;
[1613] Fix | Delete
[1614] Fix | Delete
$_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
[1615] Fix | Delete
}
[1616] Fix | Delete
[1617] Fix | Delete
/**
[1618] Fix | Delete
* Unregisters default headers.
[1619] Fix | Delete
*
[1620] Fix | Delete
* This function must be called after register_default_headers() has already added the
[1621] Fix | Delete
* header you want to remove.
[1622] Fix | Delete
*
[1623] Fix | Delete
* @see register_default_headers()
[1624] Fix | Delete
* @since 3.0.0
[1625] Fix | Delete
*
[1626] Fix | Delete
* @global array $_wp_default_headers
[1627] Fix | Delete
*
[1628] Fix | Delete
* @param string|array $header The header string id (key of array) to remove, or an array thereof.
[1629] Fix | Delete
* @return bool|void A single header returns true on success, false on failure.
[1630] Fix | Delete
* There is currently no return value for multiple headers.
[1631] Fix | Delete
*/
[1632] Fix | Delete
function unregister_default_headers( $header ) {
[1633] Fix | Delete
global $_wp_default_headers;
[1634] Fix | Delete
[1635] Fix | Delete
if ( is_array( $header ) ) {
[1636] Fix | Delete
array_map( 'unregister_default_headers', $header );
[1637] Fix | Delete
} elseif ( isset( $_wp_default_headers[ $header ] ) ) {
[1638] Fix | Delete
unset( $_wp_default_headers[ $header ] );
[1639] Fix | Delete
return true;
[1640] Fix | Delete
} else {
[1641] Fix | Delete
return false;
[1642] Fix | Delete
}
[1643] Fix | Delete
}
[1644] Fix | Delete
[1645] Fix | Delete
/**
[1646] Fix | Delete
* Checks whether a header video is set or not.
[1647] Fix | Delete
*
[1648] Fix | Delete
* @since 4.7.0
[1649] Fix | Delete
*
[1650] Fix | Delete
* @see get_header_video_url()
[1651] Fix | Delete
*
[1652] Fix | Delete
* @return bool Whether a header video is set or not.
[1653] Fix | Delete
*/
[1654] Fix | Delete
function has_header_video() {
[1655] Fix | Delete
return (bool) get_header_video_url();
[1656] Fix | Delete
}
[1657] Fix | Delete
[1658] Fix | Delete
/**
[1659] Fix | Delete
* Retrieves header video URL for custom header.
[1660] Fix | Delete
*
[1661] Fix | Delete
* Uses a local video if present, or falls back to an external video.
[1662] Fix | Delete
*
[1663] Fix | Delete
* @since 4.7.0
[1664] Fix | Delete
*
[1665] Fix | Delete
* @return string|false Header video URL or false if there is no video.
[1666] Fix | Delete
*/
[1667] Fix | Delete
function get_header_video_url() {
[1668] Fix | Delete
$id = absint( get_theme_mod( 'header_video' ) );
[1669] Fix | Delete
[1670] Fix | Delete
if ( $id ) {
[1671] Fix | Delete
// Get the file URL from the attachment ID.
[1672] Fix | Delete
$url = wp_get_attachment_url( $id );
[1673] Fix | Delete
} else {
[1674] Fix | Delete
$url = get_theme_mod( 'external_header_video' );
[1675] Fix | Delete
}
[1676] Fix | Delete
[1677] Fix | Delete
/**
[1678] Fix | Delete
* Filters the header video URL.
[1679] Fix | Delete
*
[1680] Fix | Delete
* @since 4.7.3
[1681] Fix | Delete
*
[1682] Fix | Delete
* @param string $url Header video URL, if available.
[1683] Fix | Delete
*/
[1684] Fix | Delete
$url = apply_filters( 'get_header_video_url', $url );
[1685] Fix | Delete
[1686] Fix | Delete
if ( ! $id && ! $url ) {
[1687] Fix | Delete
return false;
[1688] Fix | Delete
}
[1689] Fix | Delete
[1690] Fix | Delete
return sanitize_url( set_url_scheme( $url ) );
[1691] Fix | Delete
}
[1692] Fix | Delete
[1693] Fix | Delete
/**
[1694] Fix | Delete
* Displays header video URL.
[1695] Fix | Delete
*
[1696] Fix | Delete
* @since 4.7.0
[1697] Fix | Delete
*/
[1698] Fix | Delete
function the_header_video_url() {
[1699] Fix | Delete
$video = get_header_video_url();
[1700] Fix | Delete
[1701] Fix | Delete
if ( $video ) {
[1702] Fix | Delete
echo esc_url( $video );
[1703] Fix | Delete
}
[1704] Fix | Delete
}
[1705] Fix | Delete
[1706] Fix | Delete
/**
[1707] Fix | Delete
* Retrieves header video settings.
[1708] Fix | Delete
*
[1709] Fix | Delete
* @since 4.7.0
[1710] Fix | Delete
*
[1711] Fix | Delete
* @return array
[1712] Fix | Delete
*/
[1713] Fix | Delete
function get_header_video_settings() {
[1714] Fix | Delete
$header = get_custom_header();
[1715] Fix | Delete
$video_url = get_header_video_url();
[1716] Fix | Delete
$video_type = wp_check_filetype( $video_url, wp_get_mime_types() );
[1717] Fix | Delete
[1718] Fix | Delete
$settings = array(
[1719] Fix | Delete
'mimeType' => '',
[1720] Fix | Delete
'posterUrl' => get_header_image(),
[1721] Fix | Delete
'videoUrl' => $video_url,
[1722] Fix | Delete
'width' => absint( $header->width ),
[1723] Fix | Delete
'height' => absint( $header->height ),
[1724] Fix | Delete
'minWidth' => 900,
[1725] Fix | Delete
'minHeight' => 500,
[1726] Fix | Delete
'l10n' => array(
[1727] Fix | Delete
'pause' => __( 'Pause' ),
[1728] Fix | Delete
'play' => __( 'Play' ),
[1729] Fix | Delete
'pauseSpeak' => __( 'Video is paused.' ),
[1730] Fix | Delete
'playSpeak' => __( 'Video is playing.' ),
[1731] Fix | Delete
),
[1732] Fix | Delete
);
[1733] Fix | Delete
[1734] Fix | Delete
if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) {
[1735] Fix | Delete
$settings['mimeType'] = 'video/x-youtube';
[1736] Fix | Delete
} elseif ( ! empty( $video_type['type'] ) ) {
[1737] Fix | Delete
$settings['mimeType'] = $video_type['type'];
[1738] Fix | Delete
}
[1739] Fix | Delete
[1740] Fix | Delete
/**
[1741] Fix | Delete
* Filters header video settings.
[1742] Fix | Delete
*
[1743] Fix | Delete
* @since 4.7.0
[1744] Fix | Delete
*
[1745] Fix | Delete
* @param array $settings An array of header video settings.
[1746] Fix | Delete
*/
[1747] Fix | Delete
return apply_filters( 'header_video_settings', $settings );
[1748] Fix | Delete
}
[1749] Fix | Delete
[1750] Fix | Delete
/**
[1751] Fix | Delete
* Checks whether a custom header is set or not.
[1752] Fix | Delete
*
[1753] Fix | Delete
* @since 4.7.0
[1754] Fix | Delete
*
[1755] Fix | Delete
* @return bool True if a custom header is set. False if not.
[1756] Fix | Delete
*/
[1757] Fix | Delete
function has_custom_header() {
[1758] Fix | Delete
if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) {
[1759] Fix | Delete
return true;
[1760] Fix | Delete
}
[1761] Fix | Delete
[1762] Fix | Delete
return false;
[1763] Fix | Delete
}
[1764] Fix | Delete
[1765] Fix | Delete
/**
[1766] Fix | Delete
* Checks whether the custom header video is eligible to show on the current page.
[1767] Fix | Delete
*
[1768] Fix | Delete
* @since 4.7.0
[1769] Fix | Delete
*
[1770] Fix | Delete
* @return bool True if the custom header video should be shown. False if not.
[1771] Fix | Delete
*/
[1772] Fix | Delete
function is_header_video_active() {
[1773] Fix | Delete
if ( ! get_theme_support( 'custom-header', 'video' ) ) {
[1774] Fix | Delete
return false;
[1775] Fix | Delete
}
[1776] Fix | Delete
[1777] Fix | Delete
$video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' );
[1778] Fix | Delete
[1779] Fix | Delete
if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) {
[1780] Fix | Delete
$show_video = true;
[1781] Fix | Delete
} else {
[1782] Fix | Delete
$show_video = call_user_func( $video_active_cb );
[1783] Fix | Delete
}
[1784] Fix | Delete
[1785] Fix | Delete
/**
[1786] Fix | Delete
* Filters whether the custom header video is eligible to show on the current page.
[1787] Fix | Delete
*
[1788] Fix | Delete
* @since 4.7.0
[1789] Fix | Delete
*
[1790] Fix | Delete
* @param bool $show_video Whether the custom header video should be shown. Returns the value
[1791] Fix | Delete
* of the theme setting for the `custom-header`'s `video-active-callback`.
[1792] Fix | Delete
* If no callback is set, the default value is that of `is_front_page()`.
[1793] Fix | Delete
*/
[1794] Fix | Delete
return apply_filters( 'is_header_video_active', $show_video );
[1795] Fix | Delete
}
[1796] Fix | Delete
[1797] Fix | Delete
/**
[1798] Fix | Delete
* Retrieves the markup for a custom header.
[1799] Fix | Delete
*
[1800] Fix | Delete
* The container div will always be returned in the Customizer preview.
[1801] Fix | Delete
*
[1802] Fix | Delete
* @since 4.7.0
[1803] Fix | Delete
*
[1804] Fix | Delete
* @return string The markup for a custom header on success.
[1805] Fix | Delete
*/
[1806] Fix | Delete
function get_custom_header_markup() {
[1807] Fix | Delete
if ( ! has_custom_header() && ! is_customize_preview() ) {
[1808] Fix | Delete
return '';
[1809] Fix | Delete
}
[1810] Fix | Delete
[1811] Fix | Delete
return sprintf(
[1812] Fix | Delete
'<div id="wp-custom-header" class="wp-custom-header">%s</div>',
[1813] Fix | Delete
get_header_image_tag()
[1814] Fix | Delete
);
[1815] Fix | Delete
}
[1816] Fix | Delete
[1817] Fix | Delete
/**
[1818] Fix | Delete
* Prints the markup for a custom header.
[1819] Fix | Delete
*
[1820] Fix | Delete
* A container div will always be printed in the Customizer preview.
[1821] Fix | Delete
*
[1822] Fix | Delete
* @since 4.7.0
[1823] Fix | Delete
*/
[1824] Fix | Delete
function the_custom_header_markup() {
[1825] Fix | Delete
$custom_header = get_custom_header_markup();
[1826] Fix | Delete
if ( empty( $custom_header ) ) {
[1827] Fix | Delete
return;
[1828] Fix | Delete
}
[1829] Fix | Delete
[1830] Fix | Delete
echo $custom_header;
[1831] Fix | Delete
[1832] Fix | Delete
if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) {
[1833] Fix | Delete
wp_enqueue_script( 'wp-custom-header' );
[1834] Fix | Delete
wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() );
[1835] Fix | Delete
}
[1836] Fix | Delete
}
[1837] Fix | Delete
[1838] Fix | Delete
/**
[1839] Fix | Delete
* Retrieves background image for custom background.
[1840] Fix | Delete
*
[1841] Fix | Delete
* @since 3.0.0
[1842] Fix | Delete
*
[1843] Fix | Delete
* @return string
[1844] Fix | Delete
*/
[1845] Fix | Delete
function get_background_image() {
[1846] Fix | Delete
return get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) );
[1847] Fix | Delete
}
[1848] Fix | Delete
[1849] Fix | Delete
/**
[1850] Fix | Delete
* Displays background image path.
[1851] Fix | Delete
*
[1852] Fix | Delete
* @since 3.0.0
[1853] Fix | Delete
*/
[1854] Fix | Delete
function background_image() {
[1855] Fix | Delete
echo get_background_image();
[1856] Fix | Delete
}
[1857] Fix | Delete
[1858] Fix | Delete
/**
[1859] Fix | Delete
* Retrieves value for custom background color.
[1860] Fix | Delete
*
[1861] Fix | Delete
* @since 3.0.0
[1862] Fix | Delete
*
[1863] Fix | Delete
* @return string
[1864] Fix | Delete
*/
[1865] Fix | Delete
function get_background_color() {
[1866] Fix | Delete
return get_theme_mod( 'background_color', get_theme_support( 'custom-background', 'default-color' ) );
[1867] Fix | Delete
}
[1868] Fix | Delete
[1869] Fix | Delete
/**
[1870] Fix | Delete
* Displays background color value.
[1871] Fix | Delete
*
[1872] Fix | Delete
* @since 3.0.0
[1873] Fix | Delete
*/
[1874] Fix | Delete
function background_color() {
[1875] Fix | Delete
echo get_background_color();
[1876] Fix | Delete
}
[1877] Fix | Delete
[1878] Fix | Delete
/**
[1879] Fix | Delete
* Default custom background callback.
[1880] Fix | Delete
*
[1881] Fix | Delete
* @since 3.0.0
[1882] Fix | Delete
*/
[1883] Fix | Delete
function _custom_background_cb() {
[1884] Fix | Delete
// $background is the saved custom image, or the default image.
[1885] Fix | Delete
$background = set_url_scheme( get_background_image() );
[1886] Fix | Delete
[1887] Fix | Delete
/*
[1888] Fix | Delete
* $color is the saved custom color.
[1889] Fix | Delete
* A default has to be specified in style.css. It will not be printed here.
[1890] Fix | Delete
*/
[1891] Fix | Delete
$color = get_background_color();
[1892] Fix | Delete
[1893] Fix | Delete
if ( get_theme_support( 'custom-background', 'default-color' ) === $color ) {
[1894] Fix | Delete
$color = false;
[1895] Fix | Delete
}
[1896] Fix | Delete
[1897] Fix | Delete
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
[1898] Fix | Delete
[1899] Fix | Delete
if ( ! $background && ! $color ) {
[1900] Fix | Delete
if ( is_customize_preview() ) {
[1901] Fix | Delete
printf( '<style%s id="custom-background-css"></style>', $type_attr );
[1902] Fix | Delete
}
[1903] Fix | Delete
return;
[1904] Fix | Delete
}
[1905] Fix | Delete
[1906] Fix | Delete
$style = $color ? 'background-color: ' . maybe_hash_hex_color( $color ) . ';' : '';
[1907] Fix | Delete
[1908] Fix | Delete
if ( $background ) {
[1909] Fix | Delete
$image = ' background-image: url("' . sanitize_url( $background ) . '");';
[1910] Fix | Delete
[1911] Fix | Delete
// Background Position.
[1912] Fix | Delete
$position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
[1913] Fix | Delete
$position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );
[1914] Fix | Delete
[1915] Fix | Delete
if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) {
[1916] Fix | Delete
$position_x = 'left';
[1917] Fix | Delete
}
[1918] Fix | Delete
[1919] Fix | Delete
if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) {
[1920] Fix | Delete
$position_y = 'top';
[1921] Fix | Delete
}
[1922] Fix | Delete
[1923] Fix | Delete
$position = " background-position: $position_x $position_y;";
[1924] Fix | Delete
[1925] Fix | Delete
// Background Size.
[1926] Fix | Delete
$size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) );
[1927] Fix | Delete
[1928] Fix | Delete
if ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) {
[1929] Fix | Delete
$size = 'auto';
[1930] Fix | Delete
}
[1931] Fix | Delete
[1932] Fix | Delete
$size = " background-size: $size;";
[1933] Fix | Delete
[1934] Fix | Delete
// Background Repeat.
[1935] Fix | Delete
$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
[1936] Fix | Delete
[1937] Fix | Delete
if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
[1938] Fix | Delete
$repeat = 'repeat';
[1939] Fix | Delete
}
[1940] Fix | Delete
[1941] Fix | Delete
$repeat = " background-repeat: $repeat;";
[1942] Fix | Delete
[1943] Fix | Delete
// Background Scroll.
[1944] Fix | Delete
$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
[1945] Fix | Delete
[1946] Fix | Delete
if ( 'fixed' !== $attachment ) {
[1947] Fix | Delete
$attachment = 'scroll';
[1948] Fix | Delete
}
[1949] Fix | Delete
[1950] Fix | Delete
$attachment = " background-attachment: $attachment;";
[1951] Fix | Delete
[1952] Fix | Delete
$style .= $image . $position . $size . $repeat . $attachment;
[1953] Fix | Delete
}
[1954] Fix | Delete
?>
[1955] Fix | Delete
<style<?php echo $type_attr; ?> id="custom-background-css">
[1956] Fix | Delete
body.custom-background { <?php echo trim( $style ); ?> }
[1957] Fix | Delete
</style>
[1958] Fix | Delete
<?php
[1959] Fix | Delete
}
[1960] Fix | Delete
[1961] Fix | Delete
/**
[1962] Fix | Delete
* Renders the Custom CSS style element.
[1963] Fix | Delete
*
[1964] Fix | Delete
* @since 4.7.0
[1965] Fix | Delete
*/
[1966] Fix | Delete
function wp_custom_css_cb() {
[1967] Fix | Delete
$styles = wp_get_custom_css();
[1968] Fix | Delete
if ( $styles || is_customize_preview() ) :
[1969] Fix | Delete
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
[1970] Fix | Delete
?>
[1971] Fix | Delete
<style<?php echo $type_attr; ?> id="wp-custom-css">
[1972] Fix | Delete
<?php
[1973] Fix | Delete
// Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly.
[1974] Fix | Delete
echo strip_tags( $styles );
[1975] Fix | Delete
?>
[1976] Fix | Delete
</style>
[1977] Fix | Delete
<?php
[1978] Fix | Delete
endif;
[1979] Fix | Delete
}
[1980] Fix | Delete
[1981] Fix | Delete
/**
[1982] Fix | Delete
* Fetches the `custom_css` post for a given theme.
[1983] Fix | Delete
*
[1984] Fix | Delete
* @since 4.7.0
[1985] Fix | Delete
*
[1986] Fix | Delete
* @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the active theme.
[1987] Fix | Delete
* @return WP_Post|null The custom_css post or null if none exists.
[1988] Fix | Delete
*/
[1989] Fix | Delete
function wp_get_custom_css_post( $stylesheet = '' ) {
[1990] Fix | Delete
if ( empty( $stylesheet ) ) {
[1991] Fix | Delete
$stylesheet = get_stylesheet();
[1992] Fix | Delete
}
[1993] Fix | Delete
[1994] Fix | Delete
$custom_css_query_vars = array(
[1995] Fix | Delete
'post_type' => 'custom_css',
[1996] Fix | Delete
'post_status' => get_post_stati(),
[1997] Fix | Delete
'name' => sanitize_title( $stylesheet ),
[1998] Fix | Delete
'posts_per_page' => 1,
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function