wp_get_custom_css_post example


    public function value() {
        if ( $this->is_previewed ) {
            $post_value = $this->post_value( null );
            if ( null !== $post_value ) {
                return $post_value;
            }
        }
        $id_base = $this->id_data['base'];
        $value   = '';
        $post    = wp_get_custom_css_post( $this->stylesheet );
        if ( $post ) {
            $value = $post->post_content;
        }
        if ( empty( $value ) ) {
            $value = $this->default;
        }

        /** This filter is documented in wp-includes/class-wp-customize-setting.php */
        $value = apply_filters( "customize_value_{$id_base}", $value$this );

        return $value;
    }

function wp_get_custom_css( $stylesheet = '' ) {
    $css = '';

    if ( empty( $stylesheet ) ) {
        $stylesheet = get_stylesheet();
    }

    $post = wp_get_custom_css_post( $stylesheet );
    if ( $post ) {
        $css = $post->post_content;
    }

    /** * Filters the custom CSS output into the head element. * * @since 4.7.0 * * @param string $css CSS pulled in from the Custom CSS post type. * @param string $stylesheet The theme stylesheet name. */
Home | Imprint | This part of the site doesn't use cookies.