Recent

Display class

Display

Display class

Namespace: WebberZone\Contextual_Related_Posts\Frontend
Since: 3.5.0
Source: includes/frontend/class-display.php line 22

Methods

__construct()

Constructor class.

Since: 3.5.0
Line: 29

public function __construct(  );

Retrieves and displays related posts based on the given arguments.

Since: 3.5.0
Line: 53

static public function related_posts( $args = ... ): string;
TypeNameDescription
array$args{

Returns: string — The formatted list of related posts.

get_default_args() static

Get the default arguments for related_posts(), including the saved settings.

Since: 4.3.0
Line: 301

static public function get_default_args(  ): array;

Returns: array — Default arguments array.

get_posts() static

Retrieves an array of the related posts.

The defaults are as follows:

Since: 3.5.0
Line: 329

static public function get_posts( $args = ... ): \WP_Post[]|int[];
TypeNameDescription
array$argsOptional. Arguments to retrieve posts. See WP_Query::parse_query() for all available arguments.

Returns: \WP_Post[]|int[] — Array of post objects or post IDs.

exclude_on() static

Processes exclusion settings to return if the related posts should not be displayed on the current post.

Since: 3.5.0
Line: 352

static public function exclude_on( $post = ..., $args = ... ): bool;
TypeNameDescription
int|\WP_Post|null$postPost ID or post object. Defaults to global $post. Default null.
array$argsParameters in a query string format.

Returns: bool — True if any exclusion setting is matched.

should_cache() static

Check if the output should be cached.

Since: 3.5.0
Line: 412

static public function should_cache( $args ): bool;
TypeNameDescription
array$argsArguments to retrieve posts.

Returns: bool — True if the output should be cached.

get_the_excerpt() static

Function to create an excerpt for the post.

Since: 3.5.0
Line: 429

static public function get_the_excerpt( $post, $excerpt_length = ..., $use_excerpt = ..., $more_link_text = ..., $strip_stopwords = ... ): string;
TypeNameDescription
int|\WP_Post$postPost ID or WP_Post instance.
int|string$excerpt_lengthLength of the excerpt in words.
bool$use_excerptUse excerpt instead of content.
string$more_link_textContent for when there is more text. Default is null.
bool$strip_stopwordsStrip stopwords from the excerpt. Default is false.

Returns: string — Excerpt

Returns the link attributes.

Since: 3.5.0
Line: 546

static public function link_attributes( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes.

heading_title() static

Returns the heading of the related posts.

Since: 3.5.0
Line: 583

static public function heading_title( $args ): string;
TypeNameDescription
array$argsArray of arguments.

Returns: string — Space separated list of link attributes

before_list() static

Returns the opening tag of the related posts list.

Since: 3.5.0
Line: 616

static public function before_list( $args ): string;
TypeNameDescription
array$argsArray of arguments.

Returns: string — Space separated list of link attributes

after_list() static

Returns the closing tag of the related posts list.

Since: 3.5.0
Line: 640

static public function after_list( $args ): string;
TypeNameDescription
array$argsArray of arguments.

Returns: string — Space separated list of link attributes

before_list_item() static

Returns the opening tag of each list item.

Since: 3.5.0
Line: 665

static public function before_list_item( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

after_list_item() static

Returns the closing tag of each list item.

Since: 3.5.0
Line: 691

static public function after_list_item( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

get_the_title() static

Returns the title of each list item.

Since: 3.5.0
Line: 717

static public function get_the_title( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

get_the_author() static

Returns the author of each list item.

Since: 3.5.0
Line: 743

static public function get_the_author( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

Returns the permalink of each list item.

Since: 2.5.0
Line: 788

static public function get_permalink( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

Returns the formatted list item with link and and thumbnail for each list item.

Since: 3.5.0
Line: 814

static public function list_link( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

get_the_date() static

Returns the date.

Since: 3.5.0
Line: 872

static public function get_the_date( $args, $result ): string;
TypeNameDescription
array$argsArray of arguments.
\WP_Post$result\WP_Post object.

Returns: string — Space separated list of link attributes

get_primary_term_name() static

Display the primary term for a given post.

Since: 3.5.0
Line: 899

static public function get_primary_term_name( $post, $term = ..., $echo_value = ... ): string|void;
TypeNameDescription
int|\WP_Post$postPost ID or \WP_Post object.
string$termTerm name.
bool$echo_valueEcho or return.

Returns: string|void — Term name if $echo_value is true, void if false.

content_filter() static

Filter for ‘the_content’ to add the related posts.

Since: 3.5.0
Line: 920

static public function content_filter( $content ): string;
TypeNameDescription
string$contentPost content.

Returns: string — After the filter has been processed

generate_content() static

Helper for inserting crp code into or alongside content

Since: 3.5.0
Line: 980

static public function generate_content( $content, $crp_code ): string;
TypeNameDescription
string$contentPost content.
string$crp_codeCRP generated code.

Returns: string — After the filter has been processed

insert_after_paragraph() static

Helper for inserting code after a closing paragraph tag

Since: 3.5.0
Line: 1003

static public function insert_after_paragraph( $content, $crp_code, $paragraph_id ): string;
TypeNameDescription
string$contentPost content.
string$crp_codeCRP generated code.
int$paragraph_idParagraph number to insert after. A negative value indicates counting from the end.

Returns: string — After the filter has been processed

rss_filter() static

Filter to add related posts to feeds.

Since: 3.5.0
Line: 1041

static public function rss_filter( $content ): string;
TypeNameDescription
string$contentPost content.

Returns: string — Formatted content