PHP Class WC_Structured_Data

Since: 2.7.0
Author: Clément Cazaud ([email protected])
显示文件 Open project: woocommerce/woocommerce

Public Methods

Method Description
__construct ( ) Constructor.
generate_breadcrumblist_data ( WC_Breadcrumb $breadcrumbs ) Generates BreadcrumbList structured data.
generate_order_data ( WP_Order $order, boolean $sent_to_admin = false, boolean $plain_text = false ) Generates Order structured data.
generate_product_data ( WC_Product $product = null ) Generates Product structured data.
generate_review_data ( WP_Comment $comment ) Generates Review structured data.
generate_website_data ( ) Generates WebSite structured data.
get_data ( ) : array Gets data.
get_structured_data ( array $types ) : array Structures and returns data.
output_structured_data ( ) Sanitizes, encodes and outputs structured data.
set_data ( array $data, boolean $reset = false ) : boolean Sets data.

Protected Methods

Method Description
get_data_type_for_page ( ) : array Get data types for pages.

Method Details

__construct() public method

Constructor.
public __construct ( )

generate_breadcrumblist_data() public method

Hooked into woocommerce_breadcrumb action hook.
public generate_breadcrumblist_data ( WC_Breadcrumb $breadcrumbs )
$breadcrumbs WC_Breadcrumb Breadcrumb data.

generate_order_data() public method

Hooked into woocommerce_email_order_details action hook.
public generate_order_data ( WP_Order $order, boolean $sent_to_admin = false, boolean $plain_text = false )
$order WP_Order Order data.
$sent_to_admin boolean Send to admin (default: false).
$plain_text boolean Plain text email (default: false).

generate_product_data() public method

Hooked into woocommerce_single_product_summary action hook. Hooked into woocommerce_shop_loop action hook.
public generate_product_data ( WC_Product $product = null )
$product WC_Product Product data (default: null).

generate_review_data() public method

Hooked into woocommerce_review_meta action hook.
public generate_review_data ( WP_Comment $comment )
$comment WP_Comment Comment data.

generate_website_data() public method

Hooked into woocommerce_before_main_content action hook.

get_data() public method

Gets data.
public get_data ( ) : array
return array

get_data_type_for_page() protected method

Get data types for pages.
protected get_data_type_for_page ( ) : array
return array

get_structured_data() public method

List of types available by default for specific request: 'product', 'review', 'breadcrumblist', 'website', 'order',
public get_structured_data ( array $types ) : array
$types array Structured data types.
return array

output_structured_data() public method

Hooked into wp_footer action hook. Hooked into woocommerce_email_order_details action hook.

set_data() public method

Sets data.
public set_data ( array $data, boolean $reset = false ) : boolean
$data array Structured data.
$reset boolean Unset data (default: false).
return boolean