WC_Structured_Data::generate_website_data
Generates WebSite structured data.
Hooked into woocommerce_before_main_content hook.
Method of the class: WC_Structured_Data{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WC_Structured_Data = new WC_Structured_Data(); $WC_Structured_Data->generate_website_data();
WC_Structured_Data::generate_website_data() WC Structured Data::generate website data code WC 10.5.0
public function generate_website_data() {
$markup = array();
$markup['@type'] = 'WebSite';
$markup['name'] = get_bloginfo( 'name' );
$markup['url'] = home_url();
$markup['potentialAction'] = array(
'@type' => 'SearchAction',
'target' => home_url( '?s={search_term_string}&post_type=product' ),
'query-input' => 'required name=search_term_string',
);
$this->set_data( apply_filters( 'woocommerce_structured_data_website', $markup ) );
}