get_theme_support example

if ( is_user_logged_in() ) {
        $classes[] = 'logged-in';
    }

    if ( is_admin_bar_showing() ) {
        $classes[] = 'admin-bar';
        $classes[] = 'no-customize-support';
    }

    if ( current_theme_supports( 'custom-background' )
        && ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) ) {
        $classes[] = 'custom-background';
    }

    if ( has_custom_logo() ) {
        $classes[] = 'wp-custom-logo';
    }

    if ( current_theme_supports( 'responsive-embeds' ) ) {
        $classes[] = 'wp-embed-responsive';
    }

    
$default_editor_styles_file_contents = file_get_contents( $default_editor_styles_file );
    }

    $default_editor_styles = array();
    if ( $default_editor_styles_file_contents ) {
        $default_editor_styles = array(
            array( 'css' => $default_editor_styles_file_contents ),
        );
    }

    $editor_settings = array(
        'alignWide'                        => get_theme_support( 'align-wide' ),
        'allowedBlockTypes'                => true,
        'allowedMimeTypes'                 => get_allowed_mime_types(),
        'defaultEditorStyles'              => $default_editor_styles,
        'blockCategories'                  => get_default_block_categories(),
        'isRTL'                            => is_rtl(),
        'imageDefaultSize'                 => $image_default_size,
        'imageDimensions'                  => $image_dimensions,
        'imageEditing'                     => true,
        'imageSizes'                       => $available_image_sizes,
        'maxUploadFileSize'                => $max_upload_size,
        // The following flag is required to enable the new Gallery block format on the mobile apps in 5.9.

function wp_use_widgets_block_editor() {
    /** * Filters whether to use the block editor to manage widgets. * * @since 5.8.0 * * @param bool $use_widgets_block_editor Whether to use the block editor to manage widgets. */
    return apply_filters(
        'use_widgets_block_editor',
        get_theme_support( 'widgets-block-editor' )
    );
}

/** * Converts a widget ID into its id_base and number components. * * @since 5.8.0 * * @param string $id Widget ID. * @return array Array containing a widget's id_base and number components. */
delete_option( 'mods_' . $theme_name );
}

/** * Retrieves the custom header text color in 3- or 6-digit hexadecimal form. * * @since 2.1.0 * * @return string Header text color in 3- or 6-digit hexadecimal form (minus the hash symbol). */
function get_header_textcolor() {
    return get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
}

/** * Displays the custom header text color in 3- or 6-digit hexadecimal form (minus the hash symbol). * * @since 2.1.0 */
function header_textcolor() {
    echo get_header_textcolor();
}



        add_action( 'wp_head', 'wp_admin_bar_header' );

        add_action( 'admin_head', 'wp_admin_bar_header' );

        if ( current_theme_supports( 'admin-bar' ) ) {
            /** * To remove the default padding styles from WordPress for the Toolbar, use the following code: * add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) ); */
            $admin_bar_args  = get_theme_support( 'admin-bar' );
            $header_callback = $admin_bar_args[0]['callback'];
        }

        if ( empty( $header_callback ) ) {
            $header_callback = '_admin_bar_bump_cb';
        }

        add_action( 'wp_head', $header_callback );

        wp_enqueue_script( 'admin-bar' );
        wp_enqueue_style( 'admin-bar' );

        

function post_format_meta_box( $post$box ) {
    if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
        $post_formats = get_theme_support( 'post-formats' );

        if ( is_array( $post_formats[0] ) ) :
            $post_format = get_post_format( $post->ID );
            if ( ! $post_format ) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the active theme doesn't support it.             if ( $post_format && ! in_array( $post_format$post_formats[0], true ) ) {
                $post_formats[0][] = $post_format;
            }
            ?>
$name = $config['show_in_rest']['name'];

                if ( ! rest_is_field_included( "theme_supports.{$name}", $fields ) ) {
                    continue;
                }

                if ( ! current_theme_supports( $feature ) ) {
                    $data['theme_supports'][ $name ] = $config['show_in_rest']['schema']['default'];
                    continue;
                }

                $support = get_theme_support( $feature );

                if ( isset( $config['show_in_rest']['prepare_callback'] ) ) {
                    $prepare = $config['show_in_rest']['prepare_callback'];
                } else {
                    $prepare = array( $this, 'prepare_theme_support' );
                }

                $prepared = $prepare( $support$config$feature$request );

                if ( is_wp_error( $prepared ) ) {
                    continue;
                }
add_theme_support( 'core-block-patterns' );

/** * Registers the core block patterns and categories. * * @since 5.5.0 * @since 6.3.0 Added source to core block patterns. * @access private */
function _register_core_block_patterns_and_categories() {
    $should_register_core_patterns = get_theme_support( 'core-block-patterns' );

    if ( $should_register_core_patterns ) {
        $core_block_patterns = array(
            'query-standard-posts',
            'query-medium-posts',
            'query-small-posts',
            'query-grid-posts',
            'query-large-title-posts',
            'query-offset-posts',
            'social-links-shared-background-color',
        );

        
call_user_func( $this->admin_image_div_callback );
        } else {
            $background_styles = '';
            $bgcolor           = get_background_color();
            if ( $bgcolor ) {
                $background_styles .= 'background-color: #' . $bgcolor . ';';
            }

            $background_image_thumb = get_background_image();
            if ( $background_image_thumb ) {
                $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', $background_image_thumb ) ) ) );
                $background_position_x  = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
                $background_position_y  = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );
                $background_size        = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) );
                $background_repeat      = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
                $background_attachment  = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );

                // Background-image URL must be single quote, see below.                 $background_styles .= " background-image: url('$background_image_thumb');"
                . " background-size: $background_size;"
                . " background-position: $background_position_x $background_position_y;"
                . " background-repeat: $background_repeat;"
                . " background-attachment: $background_attachment;";
            }

        );

        $this->add_setting(
            'custom_logo',
            array(
                'theme_supports' => array( 'custom-logo' ),
                'transport'      => 'postMessage',
            )
        );

        $custom_logo_args = get_theme_support( 'custom-logo' );
        $this->add_control(
            new WP_Customize_Cropped_Image_Control(
                $this,
                'custom_logo',
                array(
                    'label'         => __( 'Logo' ),
                    'section'       => 'title_tagline',
                    'priority'      => 8,
                    'height'        => isset( $custom_logo_args[0]['height'] ) ? $custom_logo_args[0]['height'] : null,
                    'width'         => isset( $custom_logo_args[0]['width'] ) ? $custom_logo_args[0]['width'] : null,
                    'flex_height'   => isset( $custom_logo_args[0]['flex-height'] ) ? $custom_logo_args[0]['flex-height'] : null,
                    
public function enqueue() {
        wp_enqueue_media();
        wp_enqueue_script( 'customize-views' );

        $this->prepare_control();

        wp_localize_script(
            'customize-views',
            '_wpCustomizeHeader',
            array(
                'data'     => array(
                    'width'         => absint( get_theme_support( 'custom-header', 'width' ) ),
                    'height'        => absint( get_theme_support( 'custom-header', 'height' ) ),
                    'flex-width'    => absint( get_theme_support( 'custom-header', 'flex-width' ) ),
                    'flex-height'   => absint( get_theme_support( 'custom-header', 'flex-height' ) ),
                    'currentImgSrc' => $this->get_current_image_src(),
                ),
                'nonces'   => array(
                    'add'    => wp_create_nonce( 'header-add' ),
                    'remove' => wp_create_nonce( 'header-remove' ),
                ),
                'uploads'  => $this->uploaded_headers,
                'defaults' => $this->default_headers,
            )

    }

    /** * Enqueue control related scripts/styles. * * @since 4.1.0 */
    public function enqueue() {
        parent::enqueue();

        $custom_background = get_theme_support( 'custom-background' );
        wp_localize_script(
            'customize-controls',
            '_wpCustomizeBackground',
            array(
                'defaults' => ! empty( $custom_background[0] ) ? $custom_background[0] : array(),
                'nonces'   => array(
                    'add' => wp_create_nonce( 'background-add' ),
                ),
            )
        );
    }
}
// Display "Header Image" if the image was ever used as a header image.             if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) {
                $media_states[] = __( 'Header Image' );
            }

            // Display "Current Header Image" if the image is currently the header image.             if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) {
                $media_states[] = __( 'Current Header Image' );
            }
        }

        if ( get_theme_support( 'custom-header', 'video' ) && has_header_video() ) {
            $mods = get_theme_mods();
            if ( isset( $mods['header_video'] ) && $post->ID === $mods['header_video'] ) {
                $media_states[] = __( 'Current Header Video' );
            }
        }
    }

    if ( current_theme_supports( 'custom-background' ) ) {
        $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true );

        if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) {
            
/** * Deletes the site logo when all theme mods are being removed. */
function _delete_site_logo_on_remove_theme_mods() {
    global $_ignore_site_logo_changes;

    if ( $_ignore_site_logo_changes ) {
        return;
    }

    if ( false !== get_theme_support( 'custom-logo' ) ) {
        delete_option( 'site_logo' );
    }
}

/** * Hooks `_delete_site_logo_on_remove_custom_logo` in `update_option_theme_mods_$theme`. * Hooks `_delete_site_logo_on_remove_theme_mods` in `delete_option_theme_mods_$theme`. * * Runs on `setup_theme` to account for dynamically-switched themes in the Customizer. */
function _delete_site_logo_on_remove_custom_logo_on_setup_theme() {
    


    $custom_logo_id = get_theme_mod( 'custom_logo' );

    // We have a logo. Logo is go.     if ( $custom_logo_id ) {
        $custom_logo_attr = array(
            'class'   => 'custom-logo',
            'loading' => false,
        );

        $unlink_homepage_logo = (bool) get_theme_support( 'custom-logo', 'unlink-homepage-logo' );

        if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) {
            /* * If on the home page, set the logo alt attribute to an empty string, * as the image is decorative and doesn't need its purpose to be described. */
            $custom_logo_attr['alt'] = '';
        } else {
            /* * If the logo alt attribute is empty, get the site title and explicitly pass it * to the attributes used by wp_get_attachment_image(). */
Home | Imprint | This part of the site doesn't use cookies.