Tkt_Shortcodes_Shortcodes
in package

Defines all ShortCodes of the TukuToi ShortCodes Plugin.

Tags
author

Beda Schmid beda@tukutoi.com

Table of Contents

$declarations  : string
The Configuration object.
$meta_type  : string
The meta type to retrieve of this plugin.
$plugin_prefix  : string
The unique prefix of this plugin.
$version  : string
The version of this plugin.
__construct()  : mixed
Initialize the class and set its properties.
archivelinks()  : mixed
TukuToi `[archivelinks]` ShortCode.
attachmentimage()  : mixed
TukuToi `[attachmentimage]` ShortCode.
bloginfo()  : mixed
TukuToi `[bloginfo]` ShortCode.
conditional()  : mixed
TukuToi `[conditional]` ShortCode.
editlinks()  : mixed
TukuToi `[editlinks]` ShortCode.
math()  : mixed
TukuToi `[math]` ShortCode.
post_termsinfo()  : mixed
TukuToi `[post_termsinfo]` ShortCode.
postinfo()  : mixed
TukuToi `[postinfo]` ShortCode.
postmeta()  : mixed
TukuToi `[postmeta]` ShortCode.
round()  : mixed
TukuToi `[round]` ShortCode.
terminfo()  : mixed
TukuToi `[terminfo]` ShortCode.
termmeta()  : mixed
TukuToi `[termmeta]` ShortCode.
userinfo()  : mixed
TukuToi `[userinfo]` ShortCode.
usermeta()  : mixed
TukuToi `[usermeta]` ShortCode.

Properties

$declarations

The Configuration object.

private string $declarations
Description

All configurations and declarations of this plugin.

Tags
since
1.0.0
access

private

$meta_type

The meta type to retrieve of this plugin.

private string $meta_type
Description

The meta type of the object to retrieve.

Tags
since
1.0.0
access

private

$plugin_prefix

The unique prefix of this plugin.

private string $plugin_prefix
Description

The string used to uniquely prefix technical functions of this plugin.

Tags
since
1.0.0
access

private

$version

The version of this plugin.

private string $version
Description

The current version of this plugin.

Tags
since
1.0.0
access

private

Methods

__construct()

Initialize the class and set its properties.

public __construct(string $plugin_prefix, string $version, string $declarations) : mixed
Parameters
$plugin_prefix
(string) The unique prefix of this plugin.
$version
(string) The version of this plugin.
$declarations
(string) The Configuration object.
Tags
since
1.0.0
Return
(mixed)

TukuToi `[archivelinks]` ShortCode.

public archivelinks(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display links to the archives of the current, or an arbitrary Post, Term or User.
The TukuToi [archivelinks] ShortCode allows you to display any archive links easily and safely.

Example usage: [archivelinks type="my-awesome-custom-taxonomy" sanitize="url_raw"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding functions in ClassicPress are get_post_type_archive_link() and get_term_link().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the item to get the Archive Link of. Default: ''. Accepts: '', Valid item ID.
     @type string    $type       Used for Term Archive Links. Takes the taxonomy name to get the Archive Link of. Default: ''. Accepts: valid taxonomy name.
     @type string    $delimiter  How to separate the URls if retrieving several Term Links (of a post). Default: ''. Accepts: any valid string or HTML.
     @type string    $sanitize   How to sanitize the output. Default: 'url_raw'. Accepts: 
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'archivelinks'.
Tags
see
https://docs.classicpress.net/reference/functions/get_post_type_archive_link/
see
https://docs.classicpress.net/reference/functions/get_term_link/
since
1.0.0
Return
(mixed)

attachmentimage()

TukuToi `[attachmentimage]` ShortCode.

public attachmentimage(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display either the Posts Thumbnail or any Image from your website.
The TukuToi [attachmentimage] ShortCode allows you to display any image links easily and safely.

Example usage: [attachmentimage size="thumbnail" sanitize="url_raw"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding functions in ClassicPress are get_post_type_archive_link() and get_term_link().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the item to get the data of. Defaults to Post ID, or if passed, the ID of an attachemnt can be used as well. Default: ''. Accepts: '', Valid item ID.
     @type string    $url       The url of an attachment, if ID empty. Default: ''. Accepts: valid attachment URL.
     @type string    $show       Wether to show featured Image or any other image data. Default: 'featured_image'. Accepts: 'featured_image', 'other'.
     @type string    $width      Width in Pixels. Must be registered size width. Default: ''. Accepts: valid registered width in pixel.
     @type string    $height     Height in Pixels. Must be registered size height. Default: ''. Accepts: valid registered height in pixel.
     @type string    $size       Valid registered media size. Default: ''. Accpets: any valid registered image size.
     @type string    $icon       Whether to treat image as icon. Default: ''. Accepts: '', 'icon'.
     @type string    $sanitize   How to sanitize the output. Default: 'url_raw'. Accepts: 
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'attachmentimage'.
Tags
see
https://docs.classicpress.net/reference/functions/get_the_post_thumbnail_url/
see
https://docs.classicpress.net/reference/functions/wp_get_attachment_image_url/
since
1.0.0
Return
(mixed)

bloginfo()

TukuToi `[bloginfo]` ShortCode.

public bloginfo(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about your Website, such as Tagline, Site Name, RSS links.
The TukuToi [bloginfo] ShortCode allows you to display any information about your Website easily and safely.

Example usage: [bloginfo show="description" filter="display" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_bloginfo().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $show       What detail of the retrieved Bloginfo to show. Default: 'name'. Accepts: 
@see
-> $site_infos @type string $filter What fiter to apply to the output. Default: 'raw'. Accepts: 'display'. @type string $sanitize How to sanitize the output. Default: 'text_field'. Accepts:
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'bloginfo'.
Tags
see
https://docs.classicpress.net/reference/functions/get_bloginfo/
since
1.0.0
Return
(mixed)

conditional()

TukuToi `[conditional]` ShortCode.

public conditional(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display things conditionally, for example, only if the current Users's ID is equal to the Current Post Author's ID, or any other type of condition. The TukuToi [conditional] ShortCode allows you to conditionall show any information easily and safely.

Example usage: [conditional left="Any Value to Compare" right="Any Value to Compare With" else="Shows if the condition evaluates to false"]The Content that is conditionally Shown[/conditional]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $left       The value to compare in the conditional evaluation. Default: ''. Accepts: Any possible value.
     @type string    $right      The value to compare with in the conditional evaluation. Default: ''. Accepts: Any possible value.
     @type string    $operator   The comparison operator to use. Default: 'eqv'. Accepts: 
@see
-> $valid_comparison. @type string $float Whether the compared values are Float Values. Default: ''. Accepts: '', 'float'. @type string $epsilon The precision to use when comparing Float Values. Default: ''. Accepts: '', float value. @type string $else The value to show if the evaluation returns false. Default: ''. Accepts: any valid string or HTML. @type string $fx The Custom Function Name when operator is fx. Default: ''. Accepts: valid PHP function name. @type string $fx_args Arguments to pass to the Custom PHP Function. Default: ''. Accepts: comma-delimited argument:value pairs.
$content
(mixed) ShortCode enclosed content. Any Valid string, HTML or ShortCode(s). Defaults to: null
$tag
(string) The Shortcode tag. Value: 'conditional'.
Tags
since
1.0.0
since
1.25.0

Added fx and fx_args $atts (Custom PHP Function).

Return
(mixed)

TukuToi `[editlinks]` ShortCode.

public editlinks(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display edit links to edit the current, or an arbitrary Post, Term or User.
The TukuToi [editlinks] ShortCode allows you to display any edit links easily and safely.

Example usage: [editlinks item="33" type="my-awesome-custom-post" filter="display" sanitize="url_raw"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding functions in ClassicPress are get_edit_post_link() and get_edit_term_link().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the item to get the Edit Link of. Default: ''. Accepts: '', Valid item ID.
     @type string    $type       The type of content to get the Edit Link of. Default: ''. Accepts: valid post, user or taxonomy type.
     @type string    $object     Used when retrieving Term Edit Links. Default: ''. Accepts: '', valid post type.
     @type string    $delimiter  How to separate the User Meta data if retreived as Array. Default: ''. Accepts: any valid string or HTML.
     @type string    $filter     How to output the '&' character. Default: 'display'. Accepts: '', 'display'.
     @type string    $sanitize   How to sanitize the output. Default: 'url_raw'. Accepts: 
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'editlinks'.
Tags
see
https://docs.classicpress.net/reference/functions/get_edit_post_link/
see
https://docs.classicpress.net/reference/functions/get_edit_term_link/
since
1.0.0
Return
(mixed)

math()

TukuToi `[math]` ShortCode.

public math(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to do calculations with values dynamically when displaying the values. For example, you might want to calculate the sum of one field with another field of a post. The TukuToi [math] ShortCode allows you to do mathematical operations easily and safely.

Example usage: [math operand_one="3" operand_two="5" operator="*" sanitize="intval"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $operand_one    The first operand of the calculation. Default: ''. Accepts: Any calculable value.
     @type string    $operand_two    The second operand of the calculation. Default: ''. Accepts: Any calculable value.
     @type string    $operator       The operator to use. Default: ''. Accepts: 
@see
-> $valid_operators. @type string $sanitize The value to show if the evaluation returns false. Default: ''. Accepts: any valid string or HTML.
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'conditional'.
Tags
since
1.0.0
Return
(mixed)

post_termsinfo()

TukuToi `[post_termsinfo]` ShortCode.

public post_termsinfo(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary Post Terms, such as Term Name, ID or Parent ID.
The TukuToi [post_termsinfo] ShortCode allows you to display any information about any term easily and safely.

Example usage: [post_termsinfo show="name" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_the_terms().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the Post to show Post Terms of. Default: ''. Accepts: '', Valid Post ID.
     @type string    $taxonomy   The Taxonomy of which to get Post Terms of. Default: 'category'. Accepts: valid taxonomy name.
     @type string    $show       What detail of the retrieved Terms to show. Default: 'term_id'. Accepts: all public properties of the WP_Term Object, see 
@see
. @type string $delimiter How to separate the Terms Information to display, Defaul: ', '. Accepts: any valid string or HTML. @type string $sanitize How to sanitize the output. Default: 'text_field'. Accepts:
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'post_termsinfo'.
Tags
see
https://docs.classicpress.net/reference/functions/get_the_terms/
since
1.0.0
Return
(mixed)

postinfo()

TukuToi `[postinfo]` ShortCode.

public postinfo(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary Post, such as Post Title, Name, Post Body or Post Status.
The TukuToi [postinfo] ShortCode allows you to display any information about any post easily and safely.

Example usage: [postinfo show="post_status" filter="display" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_post().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the Post to show information about. Default: ''. Accepts: '', Valid Post ID.
     @type string    $show       What detail of the retrieved Post to show. Default: 'post_title'. Accepts: all public properties of the WP_Post Object, see 
@see
. @type string $filter What fiter to apply to the output. Default: 'raw'. Accepts: 'raw', 'edit', 'db', or 'display'. @type string $sanitize How to sanitize the output. Default: 'text_field'. Accepts:
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'postinfo'.
Tags
see
https://docs.classicpress.net/reference/functions/get_post/
since
1.0.0
Return
(mixed)

postmeta()

TukuToi `[postmeta]` ShortCode.

public postmeta(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary Post Meta, such as a Custom Field.
The TukuToi [postmeta] ShortCode allows you to display any information about any Post Meta easily and safely.

Example usage: [postmeta show="my-awesome-custom-field" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_post_meta().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the Post to show Post Meta of. Default: ''. Accepts: '', Valid Post ID.
     @type string    $key        The Meta Key of which to get Post Meta of. Default: ''. Accepts: valid postmeta key.
     @type string    $single     Wether to retrieve single or array Meta Data. Default: 'true'. Accepts: boolean.
     @type string    $delimiter  How to separate the Post Meta data if retreived as Array. Default: ''. Accepts: any valid string or HTML.
     @type string    $sanitize   How to sanitize the output. Default: 'text_field'. Accepts: 
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'postmeta'.
Tags
see
https://docs.classicpress.net/reference/functions/get_post_meta/
since
1.0.0
Return
(mixed)

round()

TukuToi `[round]` ShortCode.

public round(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to round up or down any floating value.
The TukuToi [round] ShortCode allows you to round any float value easily and safely into any direction and towards either odd or even.

Example usage: [round round="12.3927366478" dir="" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding functions in ClassicPress are get_post_type_archive_link() and get_term_link().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $round      The float value to round. Default: ''. Accepts: Valid float value.
     @type string    $dir        A valid PHP Round Constant, see 
@see
-> $valid_round_constants @type string $sanitize How to sanitize the output. Default: 'url_raw'. Accepts:
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'round'.
Tags
see
https://docs.classicpress.net/reference/functions/get_the_post_thumbnail_url/
see
https://docs.classicpress.net/reference/functions/wp_get_attachment_image_url/
since
1.0.0
Return
(mixed)

terminfo()

TukuToi `[terminfo]` ShortCode.

public terminfo(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary Term, such as Term Name, ID or Parent ID.
The TukuToi [terminfo] ShortCode allows you to display any information about any term easily and safely.

Example usage: [terminfo show="parent" sanitize="intval"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_term().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the Term to show information about. Default: ''. Accepts: '', Valid Term ID.
     @type string    $taxonomy   The Taxonomy to which the term belongs. Default: ''. Accepts: valid taxonomy name.
     @type string    $show       What detail of the retrieved Term to show. Default: 'name'. Accepts: all public properties of the WP_Term Object, see 
@see
. @type string $filter What fiter to apply to the output. Default: 'raw'. Accepts: '', raw'. @type string $sanitize How to sanitize the output. Default: 'text_field'. Accepts:
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'terminfo'.
Tags
see
https://docs.classicpress.net/reference/functions/get_term/
since
1.0.0
Return
(mixed)

termmeta()

TukuToi `[termmeta]` ShortCode.

public termmeta(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary Term Meta, such as a Custom Field.
The TukuToi [termmeta] ShortCode allows you to display any information about any Term Meta easily and safely.

Example usage: [termmeta show="my-awesome-custom-field" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_term_meta().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the Term to show Term Meta of. Default: ''. Accepts: '', Valid Term ID.
     @type string    $key        The Meta Key of which to get Term Meta of. Default: ''. Accepts: valid termmeta key.
     @type string    $single     Wether to retrieve single or array Meta Data. Default: 'true'. Accepts: boolean.
     @type string    $delimiter  How to separate the Term Meta data if retreived as Array. Default: ''. Accepts: any valid string or HTML.
     @type string    $sanitize   How to sanitize the output. Default: 'text_field'. Accepts: 
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'termmeta'.
Tags
see
https://docs.classicpress.net/reference/functions/get_term_meta/
since
1.0.0
Return
(mixed)

userinfo()

TukuToi `[userinfo]` ShortCode.

public userinfo(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary User, such as User Name, Email, Description and else.
The TukuToi [userinfo] ShortCode allows you to display any information about any user easily and safely.

Example usage: [userinfo show="user_email" sanitize="email"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_user().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the User to show information about. Default: ''. Accepts: '', Valid User ID.
     @type string    $field      The field to retrieve the user with. Default: 'ID'. Accepts: 'id', 'ID', 'slug', 'email', 'login'.
     @type string    $value      The value of the field to retrieve the user with. Default: ''. Accepts: valid user ID, valid user slug, valid user email, valid user login name.
     @type string    $show       What detail of the retrieved User to show. Default: 'display_name'. Accepts: all public properties of the WP_User Object and its data, see 
@see
and
@see
-> $user_data. @type string $sanitize How to sanitize the output. Default: 'text_field'. Accepts:
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'userinfo'.
Tags
see
https://docs.classicpress.net/reference/functions/get_user/
since
1.0.0
Return
(mixed)

usermeta()

TukuToi `[usermeta]` ShortCode.

public usermeta(array<string|int, mixed> $atts[, mixed $content = null ], string $tag) : mixed
Description

Sometimes you want to display information about either the current or any arbitrary User Meta, such as a Custom Field.
The TukuToi [usermeta] ShortCode allows you to display any information about any User Meta easily and safely.

Example usage: [usermeta show="my-awesome-custom-field" sanitize="text_field"]
For possible attributes see the Parameters > $atts section below or use the TukuToi ShortCodes GUI.

The corresponding function in ClassicPress is get_user_meta().

Parameters
$atts
(array<string|int, mixed>)
     The ShortCode Attributes.

     @type string    $item       ID of the User to show User Meta of. Default: ''. Accepts: '', Valid User ID.
     @type string    $key        The Meta Key of which to get User Meta of. Default: ''. Accepts: valid usermeta key.
     @type string    $single     Wether to retrieve single or array Meta Data. Default: 'true'. Accepts: boolean.
     @type string    $delimiter  How to separate the User Meta data if retreived as Array. Default: ''. Accepts: any valid string or HTML.
     @type string    $sanitize   How to sanitize the output. Default: 'text_field'. Accepts: 
@see
$content
(mixed) ShortCode enclosed content. Not applicable in this ShortCode. Defaults to: null
$tag
(string) The Shortcode tag. Value: 'usermeta'.
Tags
see
https://docs.classicpress.net/reference/functions/get_user_meta/
since
1.0.0
Return
(mixed)

Search results