mixins/filters

Mixins

filters

Methods

(inner) day(day)

Add the day filter into the request to retrieve posts for a given day

Source:
Parameters:
Name Type Description
day Number

Integer representation of the day requested

Returns:

The request instance (for chaining)

(inner) filter(props, valueopt)

Specify key-value pairs by which to filter the API results (commonly used to retrieve only posts meeting certain criteria, such as posts within a particular category or by a particular author).

Source:
Parameters:
Name Type Attributes Description
props String | Object

A filter property name string, or object of name/value pairs

value String | Number | Array <optional>

The value(s) corresponding to the provided filter property

Returns:

The request instance (for chaining)

Example
// Set a single property:
    wp.filter( 'post_type', 'cpt_event' )...

    // Set multiple properties at once:
    wp.filter({
        post_status: 'publish',
        category_name: 'news'
    })...

    // Chain calls to .filter():
    wp.filter( 'post_status', 'publish' ).filter( 'category_name', 'news' )...

(inner) month(month)

Query for posts published in a given month, either by providing the number of the requested month (e.g. 3), or the month's name as a string (e.g. "March")

Source:
Parameters:
Name Type Description
month Number | String

Integer for month (1) or month string ("January")

Returns:

The request instance (for chaining)

(inner) path(path)

Specify that we are requesting a page by its path (specific to Page resources)

Source:
Parameters:
Name Type Description
path String

The root-relative URL path for a page

Returns:

The request instance (for chaining)

(inner) taxonomy(taxonomy, term)

Restrict the query results to posts matching one or more taxonomy terms.

Source:
Parameters:
Name Type Description
taxonomy String

The name of the taxonomy to filter by

term String | Number | Array

A string or integer, or array thereof, representing terms

Returns:

The request instance (for chaining)

(inner) year(year)

Query for posts published in a given year.

Source:
Parameters:
Name Type Description
year Number

integer representation of year requested

Returns:

The request instance (for chaining)