Class post
A utility class for performing operations on or around WP posts.
Namespace: ski
Located at packages/ski.web/services/ski.wp.post.php
Methods summary
public static
string
|
#
get_opt( string $slug, mixed $default = null )
Retrives the value of a setting previously saved to the database typically
through the use of the metabox mb_ctl components or through the use of custom
fields.
Retrives the value of a setting previously saved to the database typically
through the use of the metabox mb_ctl components or through the use of custom
fields.
Parameters
- $slug
string $slug The unique key of the value to be retrieved
- $default
mixed $default If no value is found in the database, return this value instead
Returns
string The desired value
|
public static
string
|
#
get_opt_explicit( object/int $post, string $slug, mixed $default = null )
Retrives the value of a setting previously saved to the database typically
through the use of the metabox mb_ctl components or through the use of custom
fields.
Retrives the value of a setting previously saved to the database typically
through the use of the metabox mb_ctl components or through the use of custom
fields.
Parameters
- $post
object/int $post The post or post ID with the option to be retrieved
- $slug
string $slug The unique key of the value to be retrieved
- $default
mixed $default If no value is found in the database, return this value instead
Returns
string The desired value
|
public static
string
|
#
get_permalink_by_slug( string $slug )
Transforms a page/post slug into a full URL.
Transforms a page/post slug into a full URL.
Note: If you have a hierarchical page, you must include the full path (e.g.
'parent-page/sub-page').
Parameters
- $slug
string $slug The slug of the page/post desired
Returns
string The desired URL, or nothing if not found
Link
|
public static
object
|
#
get_stickies( integer $num_stickies = -1 )
Retrieves a list of the sticky posts in descending date order. This list of
posts can then be used in the a WP loop.
Retrieves a list of the sticky posts in descending date order. This list of
posts can then be used in the a WP loop.
Parameters
- $num_stickies
integer $num_stickies Can limit the number of stickies to retrieve
Returns
object A WP Query
Link
|
Magic methods summary