Properties

$path

$path : 

Type

$theme

$theme : 

Type

$theme_term

$theme_term : 

Type

$moved_blocks

$moved_blocks : 

Type

$moved_images

$moved_images : 

Type

Methods

__construct()

__construct(string  $path, array  $theme, \WP_Term  $theme_term) 

Template generator constructor

Parameters

string $path

Path to destination folder

array $theme

Theme settings

\WP_Term $theme_term

Theme Term

generate()

generate() : void

Main generation function for Template that starts all the template generation and returns production-ready zip file

create_file()

create_file(string  $file, string  $code) : void

Creates file in destination folder

Parameters

string $file

Basename and extension of new file

string $code

Code in file

create_directory()

create_directory(string  $dir_path) : boolean

Creates directory in destination folder

Parameters

string $dir_path

Name of new folder (or relative path/to/folder)

Returns

boolean —

If was directory created

remove_directory()

remove_directory(string  $dir_path) : boolean

Removes directory in destination folder

Parameters

string $dir_path

Name of folder (or relative path/to/folder)

Returns

boolean —

If was directory removed

create_basic_file()

create_basic_file(string  $filename, string  $type) : void

Creates basic file that includes it's own layout type

Parameters

string $filename

Only filename (extension .php is added automatically)

string $type

Layout type

create_static_file()

create_static_file(string  $filename, string  $name, string  $customText = false) : void

Creates static file (e.g. 404, author, search, .

..)

Parameters

string $filename

Only filename (extension .php is added automatically)

string $name

Header of page

string $customText

(optional) Custom text on page (actually only used for 404)

create_style_file()

create_style_file() : void

Creates basic style file with theme informations and default styles

get_template()

get_template(string  $filepath) : string

Gets content of template

Parameters

string $filepath

Relative path in plugin to template

Returns

string —

Template content

create_from_template()

create_from_template(string  $filename, string  $template, array  $replace = false) : void

Creates file from template

Parameters

string $filename

Only name of file we want to create (without extension)

string $template

Relative path to template

array $replace

(optional) Array of phrases to replace

create_gutenberg_blocks()

create_gutenberg_blocks() : void

Generates all gutenberg blocks from template to destination blocks folder

get_php_array()

get_php_array(array  $array, string  $variable = false) : string

Array translated to nice output PHP array If is set $variable, this array will be wrapped with PHP variable of such name

Parameters

array $array

Array you want to export

string $variable

(optional) Name of variable, if you want to wrap it with variable

Returns

string —

PHP exported output of array

grandfinale()

grandfinale() : void

Everything you've waited for in this class, ZIP function that encapsulates theme for final production

render_layout()

render_layout(string  $type, string  $customTitle = false, string  $customContent = false) : string

Renders layout to generated file, so there is no need for plugin

Parameters

string $type

Type of layout

string $customTitle

Custom title, if is it static layout

string $customContent

Custom content, if is it static layout

Returns

string —

Generated theme file content

replace_render_images()

replace_render_images(string  $html) : string

Replaces all images with new link and copy them to new theme img folder

Parameters

string $html

Input HTML from template

Returns

string —

Output HTML to template

get_page_width()

get_page_width() : string

Page width definated in Theme settings

Returns

string —

Theme width with pixels or other units

css_page_background()

css_page_background() : string

Css rule for background

Returns

string —

CSS background rule

css_page_background_additional()

css_page_background_additional() : string

Css rule for background additions

Returns

string —

Css with background additions

get_thumbnail_image()

get_thumbnail_image() : string

Theme thumbnail image

Returns

string —

Path to thumbnail

render_all_posts()

render_all_posts() : string

Renders all posts for multipost pages

Returns

string —

Generated theme file for multipost pages

render_short_post()

render_short_post() : string

Look of each post for multipost pages

Returns

string —

Single post content template