Content Functions
get_content()
/**
* Retrieve all the content regardless of status.
*
* @return array
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function get_content(): array;
get_all_content_with_filters()
/**
* Retrieve all content or content based on filters.
*
* @file App/Shared/Helpers/content.php
* @param string|null $contentTypeSlug Content type slug.
* @param int $limit Number of content to show.
* @param int|null $offset The offset of the first row to be returned.
* @param string $status Returned unescaped content based on status (all, draft, published, pending, archived)
* @return array Array of published content or content by particular content type.
* @throws CommandPropertyNotFoundException
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function get_all_content_with_filters(
?string $contentTypeSlug = null,
int $limit = 0,
int $offset = null,
string $status = 'all'
): array;
get_content_by_type_and_id()
/**
* Retrieves content by content type slug and content id.
*
* @file App/Shared/Helpers/content.php
* @param string $contentTypeSlug
* @param string $contentId
* @return false|object
* @throws CommandPropertyNotFoundException
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function get_content_by_type_and_id(string $contentTypeSlug, string $contentId): false|object;
get_content_by()
/**
* Retrieve content by a given field from the content table.
*
* @file App/Shared/Helpers/content.php
* @param string $field The field to retrieve the content with
* (id = content_id, type = content_content_type, slug = content_slug).
* @param string $value A value for $field (content_id, content_content_type, content_slug).
* @return false|object
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_by(string $field, string $value): false|object;
get_content_by_id()
/**
* Retrieve content by the content id.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId
* @return false|object
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_by_id(string $contentId): object|false;
get_content_datetime()
/**
* A function which retrieves content datetime.
*
* Purpose of this function is for the `content_datetime`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string|null $content
* @return string Content datetime.
* @throws ReflectionException
* @throws Exception
*/
function get_content_datetime(?string $content = null): string;
get_content_modified()
/**
* A function which retrieves content modified datetime.
*
* Purpose of this function is for the `content_modified`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content modified datetime or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_modified(string $contentId): string;
get_content_body()
/**
* A function which retrieves a content body.
*
* Purpose of this function is for the `content_body`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content body or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_body(string $contentId): string;
get_content_contenttype_name()
/**
* A function which retrieves a content content_type name.
*
* Purpose of this function is for the `content_content_type_name`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string|false Content type name or '' on failure.
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function get_content_contenttype_name(string $contentId): false|string;
get_content_contenttype_link()
/**
* A function which retrieves a content content_type link.
*
* Purpose of this function is for the `content_content_type_link`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content Type link.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_contenttype_link(string $contentId): string;
get_content_title()
/**
* A function which retrieves a content title.
*
* Purpose of this function is for the `content_title`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content title or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_title(string $contentId): string;
get_content_slug()
/**
* A function which retrieves a content slug.
*
* Purpose of this function is for the `content_slug`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content slug or ''.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_slug(string $contentId): string;
get_content_relative_url()
/**
* A function which retrieves a content's relative url.
*
* Purpose of this function is for the `{$contenttype}_relative_url`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content relative url or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_relative_url(string $contentId): string;
get_permalink()
/**
* A function which retrieves a content's permalink.
*
* Purpose of this function is for the `{$contenttype}_link`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content permalink or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_permalink(string $contentId): string;
the_content()
/**
* Wrapper function for `get_all_content_with_filters`.
*
* @file App/Shared/Helpers/content.php
* @param string|null $contentType The content type.
* @param int $limit Number of content to show.
* @param int|null $offset The offset of the first row to be returned.
* @param string $status Should it retrieve all statuses, published, draft, etc.?
* @return array Content.
* @throws CommandPropertyNotFoundException
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function the_content(?string $contentType = null, int $limit = 0, int $offset = null, string $status = 'all'): array;
get_contentmeta()
/**
* Retrieve content meta field for a content.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content ID.
* @param string $key Optional. The meta key to retrieve.
* @param bool $single Optional. Whether to return a single value. Default false.
* @return mixed Will be an array if $single is false. Will be value of metadata
* field if $single is true.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_contentmeta(string $contentId, string $key = '', bool $single = false): mixed;
get_contentmeta_by_mid()
/**
* Get content meta data by meta ID.
*
* @file App/Shared/Helpers/content.php
* @param string $mid
* @return array|bool
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_contentmeta_by_mid(string $mid): bool|array;
update_contentmeta()
/**
* Update content meta field based on content ID.
*
* Use the $prevValue parameter to differentiate between meta fields with the
* same key and content ID.
*
* If the meta field for the content does not exist, it will be added.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content ID.
* @param string $metaKey Metadata key.
* @param mixed $metaValue Metadata value. Must be serializable if non-scalar.
* @param mixed $prevValue Optional. Previous value to check before removing.
* Default empty.
* @return bool|string Meta ID if the key didn't exist, true on successful update,
* false on failure.
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function update_contentmeta(
string $contentId,
string $metaKey,
mixed $metaValue,
mixed $prevValue = ''
): bool|string;
update_contentmeta_by_mid()
/**
* Update content meta data by meta ID.
*
* @file App/Shared/Helpers/content.php
* @param string $mid
* @param string $metaKey
* @param string $metaValue
* @return bool
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function update_contentmeta_by_mid(string $mid, string $metaKey, string $metaValue): bool;
add_contentmeta()
/**
* Add meta data field to a content.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content ID.
* @param string $metaKey Metadata name.
* @param mixed $metaValue Metadata value. Must be serializable if non-scalar.
* @param bool $unique Optional. Whether the same key should not be added.
* Default false.
* @return false|string Meta ID on success, false on failure.
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function add_contentmeta(string $contentId, string $metaKey, mixed $metaValue, bool $unique = false): false|string;
delete_contentmeta()
/**
* Remove metadata matching criteria from a content.
*
* You can match based on the key, or key and value. Removing based on key and
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching key, if needed.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content ID.
* @param string $metaKey Metadata name.
* @param mixed $metaValue Optional. Metadata value. Must be serializable if
* non-scalar. Default empty.
* @return bool True on success, false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function delete_contentmeta(string $contentId, string $metaKey, mixed $metaValue = ''): bool;
delete_contentmeta_by_mid()
/**
* Delete content meta data by meta ID.
*
* @file App/Shared/Helpers/content.php
* @param string $mid
* @return bool
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function delete_contentmeta_by_mid(string $mid): bool;
get_content_status()
/**
* Retrieve content meta fields, based on content ID.
*
* The content meta fields are retrieved from the cache where possible,
* so the function is optimized to be called more than once.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId The content's id.
* @return mixed Content meta for the given content.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_custom(string $contentId): mixed;
get_content_custom_keys()
/**
* Retrieve meta field names for a content.
*
* If there are no meta fields, then nothing (null) will be returned.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId The content's id.
* @return array Array of the keys, if retrieved.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_custom_keys(string $contentId): array;
get_content_custom_values()
/**
* Retrieve values for a custom content field.
*
* The parameters must not be considered optional. All the content meta fields
* will be retrieved and only the meta field key values returned.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId The content's id.
* @param string $key Meta field key.
* @return array Meta field values or [].
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_custom_values(string $contentId, string $key): array;
get_content_author_id()
/**
* A function which retrieves a content author id.
*
* Purpose of this function is for the `content_author_id`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return false|string Content author id or false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_author_id(string $contentId): false|string;
get_content_author()
/**
* A function which retrieves a content author.
*
* Purpose of this function is for the `content_author`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Optional Content id or content object.
* @param bool $reverse If first name should appear first or not. Default is false.
* @return string|false Content author or false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_author(string $contentId, bool $reverse = false): false|string;
get_content_status()
/**
* A function which retrieves a content status.
*
* Purpose of this function is for the `content_status`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string|false Content status or false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_status(string $contentId): false|string;
get_content_date()
/**
* A function which retrieves content date.
*
* Uses `call_user_func_array()` function to return appropriate content date function.
* Dynamic part is the variable $type, which calls the date function you need.
*
* @file App/Shared/Helpers/content.php
* @param string $type Type of date to return: created, published, modified. Default: published.
* @param string $contentId Content id.
* @return string Content date.
*/
function get_content_date(string $type = 'published', string $contentId = ''): string;
get_content_time()
/**
* A function which retrieves content time.
*
* Uses `call_user_func_array()` function to return appropriate content time function.
* Dynamic part is the variable $type, which calls the date function you need.
*
* @file App/Shared/Helpers/content.php
* @param string $type Type of date to return: created, published, modified. Default: published.
* @param string $contentId Content id.
* @return string Content time.
*/
function get_content_time(string $type = 'published', string $contentId = ''): string;
get_content_created_date()
/**
* Retrieves content created date.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the date the content was created.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted content created date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_created_date(
string $contentId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_created_date()
/**
* Retrieves content created date.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the date the content was created.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default empty.
* @return string Formatted content created date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_created_date(string $contentId, string $format = ''): string;
get_content_created_time()
/**
* A function which retrieves content created time.
*
* Purpose of this function is for the `content_created_time`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the time the content was created.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted content created time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_created_time(
string $contentId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_created_time()
/**
* Retrieves content created time.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the time the content was written.
* Accepts 'G', 'U', or php date format value specified
* in 'time_format' option. Default empty.
* @return string Formatted content created time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_created_time(string $contentId, string $format = ''): string;
get_content_published_date()
/**
* A function which retrieves content published date.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the date the content was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted content published date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_published_date(
string $contentId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_published_date()
/**
* Retrieves content published date.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the date the content was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default empty.
* @return string Formatted content published date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_published_date(string $contentId, string $format = ''): string;
get_content_published_time()
/**
* A function which retrieves content published time.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the time the content was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted content published time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_published_time(
string $contentId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_published_time()
/**
* Retrieves content published time.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the time the content was published.
* Accepts 'G', 'U', or php date format value specified
* in 'time_format' option. Default empty.
* @return string Formatted content published time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_published_time(string $contentId, string $format = ''): string;
get_content_modified_date()
/**
* A function which retrieves content modified date.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the date the content was modified.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted content modified date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_modified_date(
string $contentId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_modified_date()
/**
* Retrieves content published date.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the date the content was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default empty.
* @return string Formatted content modified date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_modified_date(string $contentId, string $format = ''): string;
get_content_modified_time()
/**
* A function which retrieves content modified time.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the time the content was modified.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted content modified time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_modified_time(
string $contentId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_modified_time()
/**
* Retrieves content modified time.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @param string $format Format to use for retrieving the time the content was modified.
* Accepts 'G', 'U', or php date format value specified
* in 'time_format' option. Default empty.
* @return string Formatted content modified time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_modified_time(string $contentId, string $format = ''): string;
get_content_content_type_id()
/**
* A function which retrieves content content_type id.
*
* Purpose of this function is for the `content_content_type_id`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content Type id or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
*/
function get_content_content_type_id(string $contentId): string;
get_content_contenttype()
/**
* A function which retrieves content content_type.
*
* Purpose of this function is for the `content_content_type`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content Type or '' on failure
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_contenttype(string $contentId): string;
get_content_parent_id()
/**
* A function which retrieves a content's parent id.
*
* Purpose of this function is for the `content_parent_id`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return string Content parent id or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
*/
function get_content_parent_id(string $contentId): string;
/**
* A function which retrieves content sidebar.
*
* Purpose of this function is for the `content_sidebar`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return int Content sidebar integer or 0 on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_sidebar(string $contentId): int;
/**
* A function which retrieves content show in menu.
*
* Purpose of this function is for the `content_show_in_menu`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return int Content show in menu integer or 0 on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_show_in_menu(string $contentId): int;
get_content_show_in_search()
/**
* A function which retrieves content show in search.
*
* Purpose of this function is for the `content_show_in_search`
* filter.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id.
* @return int Content show in search integer or 0 on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_show_in_search(string $contentId): int;
cms_unique_content_slug()
/**
* Creates a unique content slug.
*
* @file App/Shared/Helpers/content.php
* @param string $originalSlug Original slug of content.
* @param string $originalTitle Original title of content.
* @param string|null $contentId Unique content id or null.
* @param string|null $contentType Content type of content.
* @return string Unique content slug.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function cms_unique_content_slug(
string $originalSlug,
string $originalTitle,
?string $contentId = null,
?string $contentType = null
): string;
cms_insert_content()
/**
* Insert or update a content.
*
* All the `$contentdata` array fields have filters associated with the values. The filters
* have the prefix 'pre_' followed by the field name. An example using 'content_status' would have
* the filter called, 'pre_content_status' that can be hooked into.
*
* @file App/Shared/Helpers/content.php
* @param array|ServerRequestInterface|Content $contentdata An array of data that is used for insert or update.
*
* @type string $contentTitle The content's title.
* @type string $contentBody The content's body.
* @type string $contentSlug The content's slug.
* @type string $contentAuthor The content's author.
* @type string $contentType The content's contenttype.
* @type string $contentParent The content's parent.
* @type string $contentSidebar The content's sidebar.
* @type string $contentShowInMenu Whether to show content in menu.
* @type string $contentShowInSearch Whether to show content in search.
* @type string $contentRelativeUrl The content's relative url.
* @type string $contentFeaturedImage THe content's featured image.
* @type string $contentStatus THe content's status.
* @type string $contentPublished Timestamp describing the moment when the content
* was published. Defaults to Y-m-d h:i A.
* @return Error|string|null The newly created content's content_id or throws an error or returns null
* if the content could not be created or updated.
* @throws CommandCouldNotBeHandledException
* @throws CommandPropertyNotFoundException
* @throws Exception
* @throws InvalidArgumentException
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableCommandHandlerException
* @throws UnresolvableQueryHandlerException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
function cms_insert_content(array|ServerRequestInterface|Content $contentdata): Error|string|null;
cms_update_content()
/**
* Update a content in the content document.
*
* See {@see cms_insert_content()} For what fields can be set in $contentdata.
*
* @file App/Shared/Helpers/content.php
* @param array|ServerRequestInterface|Content $contentdata An array of content data or a content object.
* @return string|Error The updated content's id or return Error if content could not be updated.
* @throws CommandCouldNotBeHandledException
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableCommandHandlerException
* @throws UnresolvableQueryHandlerException
*/
function cms_update_content(array|ServerRequestInterface|Content $contentdata): string|Error;
cms_delete_content()
/**
* Deletes content from the content document.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId The id of the content to delete.
* @return bool|Content Content on success or false on failure.
* @throws CommandCouldNotBeHandledException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableCommandHandlerException
* @throws CommandPropertyNotFoundException
*/
function cms_delete_content(string $contentId): Content|bool;
number_content_by_type()
/**
* Returns the number of content rows within a given content type.
*
* @file App/Shared/Helpers/content.php
* @param string $slug Content type slug.
* @return int Number of content rows based on content type.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function number_content_by_type(string $slug): int;
get_content_parent_dropdown_list()
/**
* Retrieves all posts
*
* @file App/Shared/Helpers/content.php
* @access private
* @param string|null $parentId Content parent id
* @param string $contentId Content id.
* @return void
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function get_content_parent_dropdown_list(string $parentId = null, string $contentId = ''): void;
get_content_class()
/**
* Retrieves an array of css class names.
*
* @file App/Shared/Helpers/content.php
* @param string $contentId Content id of current content.
* @param string|array $class One or more css class names to add to html element list.
* @return array An array of css class names.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_content_class(string $contentId, string|array $class = ''): array;
the_permalink
/**
* Displays the permalink for the current content.
*
* Uses `the_permalink` filter.
*
* @file App/Shared/Helpers/content.php
* @param string|Content|ContentId $content Content object or content id.
* @return string Content permalink.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_permalink(string|Content|ContentId $content): string;
the_body
/**
* The cms content filter.
*
* Uses `the_body` filter.
*
* @file App/Shared/Helpers/content.php
* @param string|Content|ContentId $content Content object or content id.
* @return string Content body.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_body(string|Content|ContentId $content): string;
/**
* Retrieves and displays content meta value.
*
* Uses `the_meta` filter.
*
* @file App/Shared/Helpers/content.php
* @param string|Content|ContentId $content Content object or id.
* @param string $key Content meta key.
* @return string Content meta value.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_meta(string|Content|ContentId $content, string $key): string;
the_title()
/**
* Retrieves and displays content title.
*
* Uses `the_title` filter.
*
* @file App/Shared/Helpers/content.php
* @param string|Content|ContentId $content Content object or id.
* @return string Content meta value.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_title(string|Content|ContentId $content): string;