Recent

Lazy_Load_ModuleclassPro only

Lazy_Load_Module

Replaces popular posts lists with a signed placeholder that is rendered via REST when it approaches the viewport.

Namespace: WebberZone\Top_Ten\Pro
Since: 4.4.0
Source: includes/pro/class-lazy-load-module.php line 24

Methods

__construct()

Constructor.

Since: 4.4.0
Line: 56

public function __construct(  );

maybe_lazy_load()

Replaces an eligible list with its lazy-load placeholder.

Since: 4.4.0
Line: 73

public function maybe_lazy_load( $pre, $args, $post ): string|null;
Type Name Description
string|null $pre Pre-rendered output.
array $args Display arguments.
\WP_Post|null $post Current post.

Returns: string|null — Placeholder or original value.

should_lazy_load()

Whether a list should be lazy loaded.

Since: 4.4.0
Line: 91

public function should_lazy_load( array $args ): bool;
Type Name Description
array $args Display arguments.

Returns: bool — Whether lazy loading is active.

lazy_load_placeholder()

Generates the placeholder and queues the loader script.

Since: 4.4.0
Line: 118

public function lazy_load_placeholder( array $args, $post ): string;
Type Name Description
array $args Display arguments.
\WP_Post|null $post Current post.

Returns: string — Placeholder HTML, or an empty string to render inline.

enqueue_script()

Registers and queues the lazy-load frontend script.

Since: 4.4.0
Line: 218

public function enqueue_script(  );

register_html_route()

Registers the endpoint that returns rendered popular-post HTML.

Since: 4.4.0
Line: 244

public function register_html_route(  );

get_items_html()

Returns the rendered list HTML.

Since: 4.4.0
Line: 268

public function get_items_html( $request ): \WP_REST_Response;
Type Name Description
\WP_REST_Request $request REST request.

Returns: \WP_REST_Response — REST response.