pfeifferNet

Recipe
in package

Provides recipe information.

Tags
since
1.0.0
since
6.0.0

Make class singleton.

used-by
Chapter::get_recipe_ids()
used-by
Collection::__construct()
used-by
Print_Editor_Content::__construct()
used-by
Print_Howto_Posts::__construct()
used-by
Print_Recipe_Posts::__construct()
used-by
Print_Recipes::__construct()

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
since
5.10.0

Properties

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
6.0.0

$recipes_id

The recipes category id.

protected int $recipes_id
Tags
since
5.10.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
6.0.0
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
since
5.7.0
used-by
Collection::get_recipe_ids()
used-by
User_Favourites::get_post_ids()
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
since
5.7.0
uses
WPRM_Recipe_Manager::get_recipe_ids_from_post()
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
since
5.7.0
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
todo

#95 Improve performance. Consider caching the recipe category check result as a transient to avoid having to get the categories and check the parents on every call.

since
5.10.0
used-by
enqueue_single_assets()
Return values
bool

Is recipe flag.

__construct()

Initialise the class and set its properties.

protected __construct() : void
Tags
since
5.7.0

        
On this page

Search results