get_file_path example


    public function is_block_theme() {
        if ( isset( $this->block_theme ) ) {
            return $this->block_theme;
        }

        $paths_to_index_block_template = array(
            $this->get_file_path( '/templates/index.html' ),
            $this->get_file_path( '/block-templates/index.html' ),
        );

        $this->block_theme = false;

        foreach ( $paths_to_index_block_template as $path_to_index_block_template ) {
            if ( is_file( $path_to_index_block_template ) && is_readable( $path_to_index_block_template ) ) {
                $this->block_theme = true;
                break;
            }
        }

        

    public static function get_theme_data( $deprecated = array()$options = array() ) {
        if ( ! empty( $deprecated ) ) {
            _deprecated_argument( __METHOD__, '5.9.0' );
        }

        $options = wp_parse_args( $options, array( 'with_supports' => true ) );

        if ( null === static::$theme || ! static::has_same_registered_blocks( 'theme' ) ) {
            $wp_theme        = wp_get_theme();
            $theme_json_file = $wp_theme->get_file_path( 'theme.json' );
            if ( is_readable( $theme_json_file ) ) {
                $theme_json_data = static::read_json_file( $theme_json_file );
                $theme_json_data = static::translate( $theme_json_data$wp_theme->get( 'TextDomain' ) );
            } else {
                $theme_json_data = array();
            }

            /** * Filters the data provided by the theme for global styles and settings. * * @since 6.1.0 * * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data. */
Home | Imprint | This part of the site doesn't use cookies.