Skip to main content

Additional functions

is_mobile

is_mobile(): boolean

Checking the client is mobile or others. This function is checking mobile or not, so Tablet will be returned false.

is_new

is_new(number|WP_Post $post = null, number $gap = 2): boolean

Checking the specified post is published within $gap days. If $post is null, the specified post is assigned current post in the loop.

get_page_slug

get_page_slug(number|WP_Post $page_id = null): string

Returning the specified post slug and parent post slug separated by hyphen -. e.g. if the page has child slug, and it has the parent page that has parent slug, this function returns parent-child.

remove_line_break

remove_line_break(string $text): string

Removing line breaks and spacing each rows.

loadScript

loadScript(string $name, string $path, string[] $dependencies = [], string $version = null, boolean $isFoot = false): void

This function is wrapper of wp_enqueue_script that is WordPress standard function. loadScript will be prefixed template path to $path if it's not absolute path, and appended $version to $path.
If $version is empty, it's assigned from the value specified on config.php.

loadStyle

loadStyle(string $name, string $path, string[] $dependencies = [], string $version = null): void

This function is wrapper of wp_enqueue_style that is WordPress standard function. loadStyle will be prefixed template path to $path if it's not absolute path, and appended $version to $path.
If $version is empty, it's assigned from the value specified on config.php.

get_asset_url

get_asset_url(string $path, string $version = null): string

Returns url that is prefixed template path and appended $version to $path.
If $version is empty, it's assigned from the value specified on config.php.

the_asset_url

the_asset_url(string $path, string $version = null): string

Displaying the result of get_asset_url.