pfeifferNet

Print_Editor_Content extends Printing
in package

Print content for the editor.

  • Print output includes post content and, if present, the WPRM recipe or howto.
  • Print relevant metadata for the post and recipe, such as published and updated dates, categories, tags, and chapter.
Tags
since
6.6.0
since
6.7.0

Add recipe and post metadata to output.

uses
Printing

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-editor-content.php'
Editor content partial for printing.
METADATA_CONTAINER  = 'print-editor-content-metadata.php'
Editor content metadata 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.
$metadata_container  : string
The fully qualified path to the item metadata content partial.
$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 post.
__construct()  : void
Initialise the class and set its properties.
get_featured_image_url()  : string
Return the featured image details.
get_metadata_markup()  : string
Get the metadata markup for a post and associated recipe.

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
since
5.7.0
since
5.9.0

Add post_type default variable.

since
6.3.0

Add number of posts variable.

Featured image size.

protected string FEATURED_IMAGE_SIZE = 'large'

The size of the featured image.

Tags
since
5.7.0

ITEM_CONTAINER

Editor content partial for printing.

protected string ITEM_CONTAINER = 'print-editor-content.php'
Tags
since
6.6.0

METADATA_CONTAINER

Editor content metadata partial for printing.

protected string METADATA_CONTAINER = 'print-editor-content-metadata.php'
Tags
since
6.7.0

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
since
5.4.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

$item_container

The fully qualified path to the print item content partial.

protected string $item_container
Tags
since
5.7.0

$metadata_container

The fully qualified path to the item metadata content partial.

protected string $metadata_container
Tags
since
6.7.0

$partials_dir

The path to the partials directory.

protected string $partials_dir
Tags
since
5.7.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.

render_item()

Render a 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
since
6.6.0
since
6.7.0

Add recipe and post metadata to output.

see
Printing::DEFAULT_PRINT_ARGS

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.

Tags
since
5.7.0
uses
Media::get_featured_image_url()
Return values
string

get_metadata_markup()

Get the metadata markup for a post and associated recipe.

protected get_metadata_markup(int $post_id, int $recipe_id) : string
Parameters
$post_id : int

The ID of the post to get metadata for.

$recipe_id : int

The ID of the recipe to get metadata for.

Tags
since
6.7.0
Return values
string

The metadata markup.


        
On this page

Search results