Property | Type | Description | |
---|---|---|---|
$_allow_feature_toggle | |||
$_blog_charset | |||
$_blog_id_local | |||
$_blog_id_wpcom | |||
$_convert_charset | |||
$_found_shortcode | |||
$_options | |||
$_previous_post_id |
Method | Description | |
---|---|---|
__construct ( integer $blog_id_local, integer $blog_id_wpcom ) : null | Constructor for Jetpack_RelatedPosts. | |
action_admin_init ( ) : null | Add a checkbox field to Settings > Reading for enabling related posts. | |
action_frontend_init ( ) | Load related posts assets if it's a elegiable front end page or execute search and return JSON if it's an endpoint request. | |
filter_add_target_to_dom ( string $content ) | Adds a target to the post content to load related posts into if a shortcode for it did not already exist. | |
get_for_post_id ( integer $post_id, array $args ) : array | Gets an array of related posts that match the given post_id. | |
get_options ( ) : array | Gets options set for Jetpack_RelatedPosts and merge with defaults. | |
get_target_html ( ) | Returns the HTML for the related posts section. | |
get_target_html_unsupported ( ) | Returns the HTML for the related posts section if it's running in the loop or other instances where we don't support related posts. | |
init ( ) : Jetpack_RelatedPosts | Creates and returns a static instance of Jetpack_RelatedPosts. | |
init_raw ( ) : Jetpack_RelatedPosts | Creates and returns a static instance of Jetpack_RelatedPosts_Raw. | |
parse_options ( array $input ) : array | Parses input and returnes normalized options array. | |
print_setting_head ( ) | Head JS/CSS for admin settings page. | |
print_setting_html ( ) | HTML for admin settings page. | |
rest_get_related_posts ( array $object, string $field_name, WP_REST_Request $request ) : array | Build an array of Related Posts. | |
rest_register_related_posts ( ) : null | Add Related Posts to the REST API Post response. | |
test_for_shortcode ( string $content ) | Looks for our shortcode on the unfiltered content, this has to execute early. |
Method | Description | |
---|---|---|
_action_frontend_init_ajax ( array $excludes ) : null | Generate and output ajax response for related posts API call. | |
_action_frontend_init_page ( ) : null | Adds filters and enqueues assets. | |
_allow_feature_toggle ( ) | ||
_enabled_for_request ( ) : boolean | Determines if the current post is able to use related posts. | |
_enqueue_assets ( $script, $style ) : null | Enqueues assets needed to do async loading of related posts. | |
_filter_non_public_posts ( array $related_posts ) : array | Filter out any hits that are not public anymore. | |
_generate_related_post_context ( integer $post_id ) : string | Generates a context for the related content (second line in related post output). | |
_generate_related_post_image_params ( integer $post_id ) : string | Generates the thumbnail image to be used for the post. Uses the image as returned by Jetpack_PostImages::get_image() | |
_get_coalesced_range ( array $date_range ) : array | Takes a range and coalesces it into a month interval bracketed by a time as determined by the blog_id to enhance caching. | |
_get_es_filters_from_args ( integer $post_id, array $args ) : array | Creates an array of ElasticSearch filters based on the post_id and args. | |
_get_excerpt ( string $post_excerpt, string $post_content ) : string | Returns a plain text post excerpt for title attribute of links. | |
_get_related_post_data_for_post ( integer $post_id, integer $position, integer $origin ) : array | Returns a UTF-8 encoded array of post information for the given post_id | |
_get_related_post_ids ( integer $post_id, integer $size, array $filters ) : array | Get array of related posts matched by ElasticSearch. | |
_get_related_posts ( integer $post_id, integer $size, array $filters ) : array | Workhorse method to return array of related posts matched by ElasticSearch. | |
_get_title ( string $post_title, string $post_content ) : string | Returns either the title or a small excerpt to use as title for post. | |
_log_click ( $post_id, $to_post_id, $link_position ) : null | Logs clicks for clickthrough analysis and related result tuning. | |
_setup_shortcode ( ) : null | Sets up the shortcode processing. | |
_to_utf8 ( string $text ) : string | Returns the string UTF-8 encoded |
protected _action_frontend_init_ajax ( array $excludes ) : null | ||
$excludes | array | array of post_ids to exclude |
return | null |
protected _action_frontend_init_page ( ) : null | ||
return | null |
protected _enabled_for_request ( ) : boolean | ||
return | boolean |
protected _enqueue_assets ( $script, $style ) : null | ||
return | null |
protected _filter_non_public_posts ( array $related_posts ) : array | ||
$related_posts | array | |
return | array |
protected _get_coalesced_range ( array $date_range ) : array | ||
$date_range | array | |
return | array |
protected _log_click ( $post_id, $to_post_id, $link_position ) : null | ||
return | null |
protected _setup_shortcode ( ) : null | ||
return | null |
public action_admin_init ( ) : null | ||
return | null |
public action_frontend_init ( ) |
public filter_add_target_to_dom ( string $content ) | ||
$content | string |
public get_options ( ) : array | ||
return | array |
public get_target_html ( ) |
public get_target_html_unsupported ( ) |
public static init ( ) : Jetpack_RelatedPosts | ||
return | Jetpack_RelatedPosts |
public static init_raw ( ) : Jetpack_RelatedPosts | ||
return | Jetpack_RelatedPosts |
public parse_options ( array $input ) : array | ||
$input | array | |
return | array |
public print_setting_head ( ) |
public test_for_shortcode ( string $content ) | ||
$content | string |