Recent

Featured_Image class Pro only

Featured Image block class.

Namespace: WebberZone\Top_Ten\Pro\Blocks
Since: 4.0.0
Source: includes/blocks/class-featured-image.php line 21

Methods

__construct()

Register widget with WordPress.

Line: 26

public function __construct(  );

default_attributes() static

Get the default attributes for the block.

Since: 4.0.0
Line: 39

static public function default_attributes(  ): array;

Returns: array — Default attributes.

render_block()

Modify the output of the post-featured-image block

Since: 4.0.0
Line: 65

public function render_block( $block_content, $block, $instance ): string;
TypeNameDescription
string$block_contentThe block content about to be appended.
array$blockThe full block, including name and attributes.
\WP_Block$instanceThe block instance.

Returns: string — Modified block content.

enqueue_block_editor_assets() static

Enqueue scripts and styles for the block editor.

Since: 4.0.0
Line: 176

static public function enqueue_block_editor_assets(  );

Register REST fields for the block.

Since: 4.0.0
Line: 201

public function register_custom_featured_image_endpoint(  );

get_items_params()

Get the arguments for fetching the popular posts.

Since: 4.0.0
Line: 223

public function get_items_params(  ): array;

Returns: array — Top 10 REST API popular posts arguments.

Get the featured image for a post.

Since: 4.0.0
Line: 326

public function get_featured_image( $request ): \WP_REST_Response|\WP_Error;
TypeNameDescription
\WP_REST_Request$requestThe request object.

Returns: \WP_REST_Response|\WP_Error — The featured image or WP_Error if no post ID.

get_style_attribute()

Create the style attribute for the image tag.

Since: 4.0.0
Line: 366

public function get_style_attribute( $attributes ): string;
TypeNameDescription
array$attributesThe block attributes.

Returns: string — Style attribute for the image tag.