Download the PHP package joem/saturn without Composer
On this page you can find all versions of the php package joem/saturn. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package saturn
Short Description Object-based post-type management in WordPress.
License
Informations about the package saturn
An object-mapped post type builder & interface for WordPress.
Saturn is a fluent interface used to effortlessly create and manipulate post types and their contents in WordPress.
How Effortlessly? Take a look:
Saturn is designed to almost act as a model, or resource to represent a post type, this means you can create, delete and change post types through an instance of Saturn, and it's easy peasy.
Not only that, Saturn provides a query engine to interact with post objects (or pages) directly within the instance.
The query builder wraps get_posts
, which means everything in get_posts
is possible from a saturn instance - with
a beautifully simple interface.
Create an instance
Creating an instance of Saturn is simple:
Saturn requires an array of parameters, which are used to construct the post type and create the instance:
Parameters
- slug (string) - The slug used to identify the post type.
- singular (string) - The singular name of the post type - human readable, used in labels.
- plural (string) - The plural name of the post type - human readable, used in labels.
- namespace (string) - The text & theme namespace (often referred to as domain) for the text strings.
Instance methods
Methods which are available in an instance of Saturn are detailed below.
instance
Usage
$saturn->instance();
Return
Type: Object
WP_Post_Type
An instance of a post type. We do not recommend altering its contents - instead, use Saturn methods. Helpful to quickly access the object.
query
Usage
$saturn->query();
Return
Type: Object
Saturn
Used to clear any lingering parameters in the query engine from previous queries. It is important to use this method before setting up queries to prevent any strange or unexpected results.
limit
Parameters
- quantity (int) - The quantity of objects to return for a specified query.
Usage
$saturn->limit( 15 );
Return
Type: Object
Saturn
Sets the number of objects to return from a query. The query engine will return the FIRST n matches if specified.
meta
Parameters
-
metaQuery (array) - An array which can contain a single key-value pair, where the key is the meta slug, and the value is the meta value. You can query multiple meta values by instead passing an array of arrays which contain the key-value pair.
- queryConfig (array) - A list of key-value config items, which would otherwise be provided inside of
meta_query
. An example of config item would berelation
. Not required.
Usage
Single meta query:
Multiple meta queries:
Multiple meta queries with config:
Return
Type: Object
Saturn
Sets the meta_query for the query.
tax
Add a tax_query to the query. Parameters
- taxQuery (array) - An array containing a single taxonomy query, to the spec of
WP_Query
'stax_query
parameter.
Usage