BuddyClients Docs

functions.php

Table of Contents

Functions

buddyc_curr_url()  : string
Retrieves the current url.
buddyc_truncate_content()  : string
Clips content by word count.
buddyc_truncate_content_by_char()  : string
Clips content by character count.
buddyc_format_status()  : mixed
Formats status value for display.
buddyc_time_has_passed()  : bool
Checks whether a time has passed.
buddyc_hex_to_rgba()  : mixed
Converts a hex code to rgba.
buddyc_js_alert()  : mixed
Outputs a javascript alert.
buddyc_inline_style()  : mixed
Adds inline styles to the front end.
buddyc_inline_script()  : mixed
Adds inline scripts to the front end or admin area.

Functions

buddyc_curr_url()

Retrieves the current url.

buddyc_curr_url() : string
Tags
since
1.0.4
Return values
string

The current url, or an empty string on failure.

buddyc_truncate_content()

Clips content by word count.

buddyc_truncate_content(string $content, int $word_count) : string
Parameters
$content : string

Content to truncate.

$word_count : int

Number of words.

Tags
since
0.1.0
Return values
string

$content Truncated content.

buddyc_truncate_content_by_char()

Clips content by character count.

buddyc_truncate_content_by_char(string $content, int $char_count) : string
Parameters
$content : string

Content to truncate.

$char_count : int

Number of characters.

Tags
since
0.1.0
Return values
string

$content Truncated content.

buddyc_format_status()

Formats status value for display.

buddyc_format_status(string $value[, mixed $add_class = null ]) : mixed
Parameters
$value : string

The value to format.

$add_class : mixed = null
Tags
since
0.1.0

buddyc_time_has_passed()

Checks whether a time has passed.

buddyc_time_has_passed(string|int $target_time) : bool
Parameters
$target_time : string|int

The time to check.

Tags
since
1.0.17
Return values
bool

True if the time has passed, false if not.

buddyc_hex_to_rgba()

Converts a hex code to rgba.

buddyc_hex_to_rgba(string $hex[, int $alpha = 0.6 ]) : mixed
Parameters
$hex : string

The hex code to convert.

$alpha : int = 0.6

Optional. The alpha value for transparency. Defaults to 0.6.

Tags
since
1.0.23

buddyc_js_alert()

Outputs a javascript alert.

buddyc_js_alert(string $message[, bool $admin = false ]) : mixed
Parameters
$message : string

The alert text.

$admin : bool = false

Optional. Whether to also apply the script to the admin area. Defaults to false (i.e., front end).

Tags
since
1.0.20

buddyc_inline_style()

Adds inline styles to the front end.

buddyc_inline_style(string $css[, bool $admin = false ]) : mixed
Parameters
$css : string

The CSS to add.

$admin : bool = false

Optional. Whether to also apply the styles to the admin area. Defaults to false.

Note: This function should be called on a hook that runs before wp_enqueue_scripts, such as init, to ensure the styles are properly enqueued and applied.

Tags
since
1.0.20

buddyc_inline_script()

Adds inline scripts to the front end or admin area.

buddyc_inline_script(string $script[, bool $admin = false ][, bool $direct = false ]) : mixed
Parameters
$script : string

The JavaScript to add.

$admin : bool = false

Optional. Whether to also apply the script to the admin area. Defaults to false (i.e., front end).

$direct : bool = false

Optional. Whether to call the inline script function immediately, as opposed to using a hook. Defaults to false.

Tags
since
1.0.20

        
On this page

Search results