functions.php

Defines basic utility functions

Functions

WE_als()

WE_als(  $id = false) : \WP-Elements

Main instance of WP-Elements.

Returns the main instance of PC to prevent the need to use globals.

Parameters

$id

Returns

\WP-Elements

als_get_option()

als_get_option(  $option = false) : mixed

Gets a user defined option

Parameters

$option

Returns

mixed —

bool when no value is found; the value otherwise

als_is_array()

als_is_array(  $array) : boolean

Validates an array

Parameters

$array

the array to validate

Returns

boolean —

true on validate or false on invalid value

als_is_string()

als_is_string(  $string) : boolean

Validates a string

Parameters

$string

the string to validate

Returns

boolean —

true on validate or false on invalid value

als_query_modifier()

als_query_modifier(  $modifier,   $q) : boolean

Get's a given search modifier from a search term

Parameters

$modifier

the modifier eg intittle:

$q

the query

Returns

boolean —

true on validate or false on invalid value

als_post_types()

als_post_types() : array

Returns an array of searchable post types.

Returns

array —

an array of selected post types

als_ajax_init()

als_ajax_init() : void

Prints the frontend HTML needed to run Ajax Live Search

als_results_vs_no_results()

als_results_vs_no_results() : array

Returns an array containing the number of searches containing results and searches that don't have results.

For example; If it returns array(10, 20), that means that 10 searches lacked results while 20 searches on the website had results.

Returns

array —
  • An array containg the number of searches without results and those with results.