Theme Functions
If you are interested in plugin development, check out the Theme guide.
get_theme()
/**
* Retrieve name of the current theme.
*
* @file core/Shared/Helpers/theme.php
* @return string Theme name.
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws InvalidArgumentException
* @throws Exception
* @throws ReflectionException
*/
function get_theme(): string
theme_name()
/**
* Retrieve active theme's name.
*
* @file core/Shared/Helpers/theme.php
* @return mixed|string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
*/
function theme_name(): mixed
theme_url()
/**
* Returns full base url of the themes' directory.
*
* @file core/Shared/Helpers/theme.php
* @param string $path Optional. Extra path appended to the end of the URL, including
* the relative directory if $theme is supplied. Default empty.
* @param string $theme Optional. A full path to a file inside a theme.
* The URL will be relative to its directory. Default empty.
* Typically, this is done by passing `__FILE__` as the argument.
* @return string Themes' URL link with optional paths appended.
* @throws Exception
* @throws ReflectionException
*/
function theme_url(string $path = '', string $theme = ''): string
theme_directory_uri()
/**
* Returns theme directory URI.
*
* @file App/Shared/Helpers/theme.php
* @uses \Qubus\EventDispatcher\ActionFilter\Filter::getInstance()->applyFilter() Calls 'theme_directory_uri' filter.
* @return string Devflow theme directory uri.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function theme_directory_uri(): string
javascript_directory_uri()
/**
* Returns javascript directory uri.
*
* @file App/Shared/Helpers/theme.php
* @uses \Qubus\EventDispatcher\ActionFilter\Filter::getInstance()->applyFilter() Calls 'javascript_directory_uri' filter.
* @return string Devflow javascript url.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function javascript_directory_uri(): string
raw_theme_root()
/**
* Returns raw theme root relative to the supplied path or filename.
* @param string $pathOrFilename
* @return string
*/
function raw_theme_root(string $pathOrFilename): string
theme_root()
/**
* Get the filesystem directory path (with trailing slash) for the theme __FILE__ passed in.
*
* @param string|null $filename The filename of the theme (__FILE__).
* @return string The filesystem path of the directory that contains the theme.
* @throws Exception
* @throws ReflectionException
*/
function theme_root(?string $filename = ''): string
less_directory_uri()
/**
* Retrieve less directory uri.
*
* @file App/Shared/Helpers/theme.php
* @uses \Qubus\EventDispatcher\ActionFilter\Filter::getInstance()->applyFilter() Calls 'less_directory_uri' filter.
* @return string Devflow less url.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function less_directory_uri(): string
css_directory()
/**
* Returns the base directory for theme stylesheet.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
*/
function css_directory(): string
css_directory_uri()
/**
* Return css directory uri.
*
* @file App/Shared/Helpers/theme.php
* @uses \Qubus\EventDispatcher\ActionFilter\Filter::getInstance()->applyFilter() Calls 'css_directory_uri' filter.
* @return string Devflow css url.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function css_directory_uri(): string
image_directory_uri()
/**
* Retrieve image directory uri.
*
* @file App/Shared/Helpers/theme.php
* @uses \Qubus\EventDispatcher\ActionFilter\Filter::getInstance()->applyFilter() Calls 'image_directory_uri' filter.
* @return string Devflow image url.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function image_directory_uri(): string
theme_info()
/**
* Retrieves metadata about a theme.
*
* @file App/Shared/Helpers/theme.php
* @access private
* @param string $themesDir
* @return array
* @throws TypeException
*/
function theme_info(string $themesDir = ''): array
activate_theme()
/**
* Activates a specific theme by namespace.
*
* @file App/Shared/Helpers/theme.php
* @param string $theme ID of the theme to activate
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ReflectionException|InvalidArgumentException
*/
function activate_theme(string $theme): void
deactivate_theme()
/**
* Deactivates an active theme.
*
* @file App/Shared/Helpers/theme.php
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function deactivate_theme(): void
is_theme_active()
/**
* Checks if a theme is active.
*
* @param string $theme
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws Exception
*/
function is_theme_active(string $theme = ''): bool
load_active_theme()
/**
* Executes the active theme.
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws Exception
*/
function load_active_theme(): void
has_content()
/**
* Checks whether there is content.
*
* @param string|null $type
* @param int $limit
* @param int|null $offset
* @param string $status
* @return bool
* @throws CommandPropertyNotFoundException
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function has_content(?string $type = null, int $limit = 0, ?int $offset = null, string $status = 'published'): bool
the_content()
/**
* Loops through all content.
*
* @return bool
*/
function the_content(): bool
content_id()
/**
* The content's unique id.
*
* @return string
*/
function content_id(): string
content_title()
/**
* The content's title.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function content_title(): string
content_slug()
/**
* The content's slug.
*
* @return string
*/
function content_slug(): string
content_body()
/**
* The content's body.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function content_body(): string
content_author()
/**
* The content's author.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function content_author(): string
content_featured_image()
/**
* The content's featured image.
*
* @return string
*/
function content_featured_image(): string
content_permalink()
/**
* The content's permalink.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function content_permalink(): string
content_published_date()
/**
* The content's published date.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function content_published_date(): string
content_published_time()
/**
* The content's published time.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function content_published_time(): string
content_published_datetime()
/**
* The content's published datetime.
*
* @return string
* @throws Exception
* @throws InvalidArgumentException
* @throws ReflectionException
*/
function content_published_datetime(): string
has_products()
/**
* Checks whether there are products.
*
* @param int $limit
* @param int|null $offset
* @param string $status
* @return bool
* @throws CommandPropertyNotFoundException
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function has_products(int $limit = 0, ?int $offset = null, string $status = 'published'): bool
the_product()
/**
* Loops through all products.
*
* @return bool
*/
function the_product(): bool
product_id()
/**
* The product's unique id.
*
* @return string|null
*/
function product_id(): ?string
product_title()
/**
* The product's title.
*
* @return string|null
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function product_title(): ?string
product_slug()
/**
* The product's slug.
*
* @return string|null
*/
function product_slug(): ?string
product_body()
/**
* The product's body.
*
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function product_body(): string
product_author()
/**
* The product's author.
*
* @return string|false
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function product_author(): string|false
product_sku()
/**
* The product's sku.
*
* @return string|false
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function product_sku(): string|false
product_price()
/**
* The product's price.
*
* @return string|null
*/
function product_price(): ?string
product_currency()
/**
* The product's currency.
*
* @return string|null
*/
function product_currency(): ?string
product_purchase_url()
/**
* The product's purchase url.
*
* @return string|null
*/
function product_purchase_url(): ?string
product_featured_image()
/**
* The product's featured image.
*
* @return string|null
*/
function product_featured_image(): ?string
product_permalink()
/**
* The product's permalink.
*
* @return string|null
* @throws Exception
* @throws ReflectionException
*/
function product_permalink(): ?string
product_published_date()
/**
* The product's published date.
*
* @return string|null
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function product_published_date(): ?string
product_published_time()
/**
* The product's published time.
*
* @return string|null
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function product_published_time(): ?string
product_published_datetime()
/**
* The product's published datetime.
*
* @return string|null
* @throws Exception
* @throws ReflectionException
*/
function product_published_datetime(): ?string