Print_Howto_Posts
extends Printing
in package
Print howto posts collection.
- Howto posts are WP Recipe Maker non-food posts.
Tags
Table of Contents
Constants
- DEFAULT_PRINT_ARGS = array('content' => 'post', 'from' => '', 'to' => '', 'updated' => false, 'tid' => 0, 'num_posts' => -1, 'order' => 'ASC', 'order_by' => 'name', 'post_ids' => array(), 'recipe_ids' => array(), 'include_recipes' => false, 'post_type' => array('post', 'pfic_ingredient'), 'recipes_only' => false, 'url' => '')
- Default arguments for printing.
- FEATURED_IMAGE_SIZE = 'large'
- Featured image size.
- ITEM_CONTAINER = 'print-howto-post.php'
- Howto content partial for printing.
- WPRM_START_STRING = '<!-- wp:wp-recipe-maker/recipe '
- Start of WPRM content in post content.
Properties
- $chapter : Chapter
- The instance of the Chapter class.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $item_container : string
- The fully qualified path to the print item content partial.
- $media : Media
- The instance of the pNet media class.
- $partials_dir : string
- The path to the partials directory.
- $posts : Posts
- The instance of the Posts class.
- $recipe : Recipe
- The instance of the Recipe class.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- render() : void
- Add content to print page.
- render_item() : void
- Render a howto post.
- __construct() : void
- Initialise the class and set its properties.
- get_featured_image_url() : string
- Return the featured image details.
Constants
DEFAULT_PRINT_ARGS
Default arguments for printing.
protected
array<string|int, mixed>
DEFAULT_PRINT_ARGS
= array('content' => 'post', 'from' => '', 'to' => '', 'updated' => false, 'tid' => 0, 'num_posts' => -1, 'order' => 'ASC', 'order_by' => 'name', 'post_ids' => array(), 'recipe_ids' => array(), 'include_recipes' => false, 'post_type' => array('post', 'pfic_ingredient'), 'recipes_only' => false, 'url' => '')
{ The default arguments to determine print content. @type string $content The type of content to display. Required - will default to post if not specified. @type string $from The inclusive start date for date range. @type string $to The inclusive end date for date range. @type bool $updated Use published date (false) or updated date (true). Defaults to false. @type int|string $tid The term id of the chapter to print, or 'all' to include all chapters. @type int $num_posts The number of posts to return.. @type string $order The posts sort order. @type string $orderby The posts sort key. @type int[] $post_ids The array of post_ids to print. @type int[] $recipe_ids The array of recipe ids to print. @type bool $include_recipes Flag to indicate if recipes hould be included in menu output. @type string[] $post_type The array of post types to include in query. @type bool $recipes-only Flag to indicate if only recipes should be included in the print output. @type string $url The URL of the relevant post or page. Used to build the QR code. }
Tags
FEATURED_IMAGE_SIZE
Featured image size.
protected
string
FEATURED_IMAGE_SIZE
= 'large'
The size of the featured image.
Tags
ITEM_CONTAINER
Howto content partial for printing.
protected
string
ITEM_CONTAINER
= 'print-howto-post.php'
Tags
WPRM_START_STRING
Start of WPRM content in post content.
protected
string
WPRM_START_STRING
= '<!-- wp:wp-recipe-maker/recipe '
- The trailing space is important to avoid detecting other WPRM content.
Tags
Properties
$chapter
The instance of the Chapter class.
protected
Chapter
$chapter
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$item_container
The fully qualified path to the print item content partial.
protected
string
$item_container
Tags
$media
The instance of the pNet media class.
protected
Media
$media
Tags
$partials_dir
The path to the partials directory.
protected
string
$partials_dir
Tags
$posts
The instance of the Posts class.
protected
Posts
$posts
Tags
$recipe
The instance of the Recipe class.
protected
Recipe
$recipe
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.
render()
Add content to print page.
public
render([array<string|int, mixed> $args = array() ]) : void
- Choose the content to include, determined by the listed posts or chapter id arguments.
- Maybe override this in child classes.
Parameters
- $args : array<string|int, mixed> = array()
-
The arguments to determine print content.
Tags
render_item()
Render a howto post.
public
render_item(int $post_id, array<string|int, mixed> $args) : void
Parameters
- $post_id : int
-
The ID of the post to use.
- $args : array<string|int, mixed>
-
The arguments to determine print content.
Tags
__construct()
Initialise the class and set its properties.
protected
__construct() : void
Tags
get_featured_image_url()
Return the featured image details.
protected
get_featured_image_url(int $post_id) : string
Parameters
- $post_id : int
-
The ID of the post to use.