Functions

get_primary_term

Returns the "primary" term, which means the first that is in the list. Respects term order.

package

Default

Arguments

$taxonomy

string

$post_id

mixed

« More »

Functions

dump

Takes all parameters and dumps them in a nice readable format. Unlike with xdebug var_dump or print_r, flexbox shouldn't ruin the day.

package

Default

« More »

Functions

current_url

Return the current, full URL.

Because PHP is incompetent and unable to do so with a single server var.

package

Default

Response

string

« More »

enqueue

Replacement for wp_enqueue_script & wp_enqueue_style. Handles cachebusting hashes.

define('WPT_ENQUEUE_STRIP_PATH', '/data/wordpress/htdocs'); \rnb\core\enqueue(get_stylesheet_directory() . '/build/client.*.js');

package

Default

Arguments

$path

string

$deps

array

« More »

env

Returns current env, defaulting to production if none set.

package

Default

Response

string

« More »

init

Run wordpress-tools core operations.

package

Default

« More »

is_dev

Return wether env is development or not.

package

Default

Response

boolean

« More »

is_prod

Return wether env is production or not.

package

Default

Response

boolean

« More »

register_strings

Registers Polylang strings. Must be called in admin.

package

Default

« More »

slugify

Return string in slugish format. Useful for creating HTML ids and such.

package

Default

Arguments

$string

string

Response

string

« More »

tag

Concats strings and arrays into one string. Useful for tags.

package

Default

Arguments

$parts

\rnb\core\mixe}

$glue

string

Response

string

« More »

Functions

captioned_image

Returns an image element with captions.

package

Default

Arguments

$image

mixed

$size

string

$responsive

boolean

« More »

get_image_data

Return all relevant data for an image as an array.

package

Default

Arguments

$image

mixed

$size

string

« More »

image

Returns an image element.

Usage: <?=\rnb\media\image($image, 'your-size')?>

package

Default

Arguments

$image

mixed

$size

string

$responsive

boolean

« More »

inline_svg

Return an inline svg element, contained in a wrapper div.

package

Default

Arguments

$name

mixed

« More »

themeresource

Returns URl for local resource, relative to theme root.

Usage: <?=\rnb\media\themeresource($image, 'your-size')?>

package

Default

Arguments

$resource

string

$mode

string

Determines wether to return server side or client side path.

« More »

Functions

date

Returns a <time> element containing the time. Pass falsy value to format to exclude them from output.

package

Default

Arguments

$date_format

string

$time_format

string

$time

mixed

Optionally pass custom time

« More »

get

Prints a template. Templates can be just about anything, but they must have a function with the name you use to print the template. See sample_template() and sample_template_named_params().

package

Default

deprecated

Arguments

$template

string

Template init function name

$variables

array

Array without string keys, will be passed as function arguments.

Response

mixed

« More »

list_all

Return list of files in path relative to current file.

package

Default

Arguments

$path

string

« More »

load_glob

Load templates from dir using glob.

Usage: load_glob(dirname(FILE) . '/templates/*')

package

Default

Arguments

$directory

string

« More »

output

Outputs a template. Templates are just functions that you can give parameters.

See sample_template() and sample_template_named_params().

package

Default

Arguments

$template

string

$variables

array

« More »

readmore

Returns a <a> element containing the permalink.

package

Default

Arguments

$post_id

mixed

$text

string

« More »

sample_template

Sample template for those unsure. This is the template init function, you could use classes if you wanted. Usage: <?=\rnb\template\get('\rnb\template\sample_template', ['Hello', 'world!']);

package

Default

Arguments

$title

string

$content

string

« More »

sample_template_named_params

Sample template using "named parameters". Usage: <?=\rnb\template\get('\rnb\template\sample_template_named_params', [['title' => 'Hello world!']]);

package

Default

Arguments

$data

array

« More »

save

Return template instead of printing it. Uses get() internally.

package

Default

deprecated

Arguments

$template

string

Function name

$variables

array

Anything you pass with this array will be used as function parameters for the template.

« More »

term

Returns a <a> element containing the "primary" (first) term. Optionally pass and ID or term object to retrieve that term as an element.

package

Default

Arguments

$taxonomy

string

$term

mixed

$options

array

(optional)

« More »

to_string

Returns template output as string, and discards any return value.

package

Default

Arguments

$template

string

$variables

array

« More »

Functions

excerpt

Return the excerpt as a template tag, using get_excerpt().

package

Default

Arguments

$post_id

mixed

$fallback

boolean

« More »

get_excerpt

Return post excerpt. Tries to get a dedicated custom field first, then falls back to native excerpt and finally gets a preview from content unless told not to.

package

Default

Arguments

$post_id

mixed

$fallback

boolean

« More »

get_preview

Get preview from the content. Stops at first paragraph.

package

Default

Arguments

$post_id

mixed

« More »

preview

Return a preview of the post as a template tag, using get_preview().

package

Default

Arguments

$word_count

integer

$more

string

$post_id

mixed

« More »

Functions

Functions

get_acf_option

Return a field from ACF options page using the current language.

You must construct your option pages like this: Base: http://i.imgur.com/8ypMOjx.png Actual options, do for every language: http://i.imgur.com/uwvsgMj.png

package

Default

Arguments

$option

string

$location

string

$format

boolean

« More »