Recipe
in package
Provides recipe information.
Tags
Table of Contents
Constants
- RECIPES_SLUG = 'recipes'
- The recipes category slug.
Properties
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $recipes_id : int
- The recipes category id.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- get_post_ids_from_recipes() : array<string|int, int>
- Return the parent post ids from recipe ids.
- get_recipe_ids_from_posts() : array<string|int, int>
- Return the recipe ids from post ids.
- get_template_slug() : string
- Return the slug of the requested WPRM template.
- is_recipe() : bool
- Return whether the current post in in recipe parent category.
- __construct() : void
- Initialise the class and set its properties.
Constants
RECIPES_SLUG
The recipes category slug.
protected
string
RECIPES_SLUG
= 'recipes'
Tags
Properties
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$recipes_id
The recipes category id.
protected
int
$recipes_id
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
get_post_ids_from_recipes()
Return the parent post ids from recipe ids.
public
get_post_ids_from_recipes([array<string|int, int> $recipe_ids = array() ]) : array<string|int, int>
Parameters
- $recipe_ids : array<string|int, int> = array()
-
The array of recipe ids to get post id from.
Tags
Return values
array<string|int, int> —The post ids.
get_recipe_ids_from_posts()
Return the recipe ids from post ids.
public
get_recipe_ids_from_posts([array<string|int, int> $post_ids = array() ]) : array<string|int, int>
Parameters
- $post_ids : array<string|int, int> = array()
-
The array of post ids to get recipe ids from.
Tags
Return values
array<string|int, int> —The recipe ids.
get_template_slug()
Return the slug of the requested WPRM template.
public
get_template_slug([string $type = 'single' ][, string $recipe_type = 'food' ]) : string
Parameters
- $type : string = 'single'
-
The type of template - defaults to single.
- $recipe_type : string = 'food'
-
The type of recipe - defaults to food.
Tags
Return values
string —The template slug.
is_recipe()
Return whether the current post in in recipe parent category.
public
is_recipe([int $post_id = 0 ]) : bool
Parameters
- $post_id : int = 0
-
The post_id to check. Will use current post if not specified.
Tags
Return values
bool —Is recipe flag.
__construct()
Initialise the class and set its properties.
protected
__construct() : void