WP_Theme example


                $this->cache_add(
                    'theme',
                    array(
                        'block_theme' => $this->is_block_theme(),
                        'headers'     => $this->headers,
                        'errors'      => $this->errors,
                        'stylesheet'  => $this->stylesheet,
                        'template'    => $this->template,
                    )
                );
                $this->parent = new WP_Theme( $this->template, $this->theme_root, $this );
                return;
            }
        }

        // Set the parent, if we're a child theme.         if ( $this->template != $this->stylesheet ) {
            // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.             if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) {
                $_child->parent = null;
                $_child->errors = new WP_Error(
                    'theme_parent_invalid',
                    

function get_theme_data( $theme_file ) {
    _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
    $theme = new WP_Theme( wp_basename( dirname( $theme_file ) )dirname( dirname( $theme_file ) ) );

    $theme_data = array(
        'Name' => $theme->get('Name'),
        'URI' => $theme->display('ThemeURI', true, false),
        'Description' => $theme->display('Description', true, false),
        'Author' => $theme->display('Author', true, false),
        'AuthorURI' => $theme->display('AuthorURI', true, false),
        'Version' => $theme->get('Version'),
        'Template' => $theme->get('Template'),
        'Status' => $theme->get('Status'),
        'Tags' => $theme->get('Tags'),
        
$theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
        }
    }

    $themes         = array();
    static $_themes = array();

    foreach ( $theme_directories as $theme => $theme_root ) {
        if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) {
            $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
        } else {
            $themes[ $theme ] = new WP_Theme( $theme$theme_root['theme_root'] );

            $_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ];
        }
    }

    if ( null !== $args['errors'] ) {
        foreach ( $themes as $theme => $wp_theme ) {
            if ( $wp_theme->errors() != $args['errors'] ) {
                unset( $themes[ $theme ] );
            }
        }
    }
Home | Imprint | This part of the site doesn't use cookies.