Automattic\WooCommerce\Blocks\BlockTypes
ProductCollectionNoResults::modify_anchor_tag_urls()
Set the URL attributes for "clearing any filters" and "Store's home" links.
Method of the class: ProductCollectionNoResults{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->modify_anchor_tag_urls( $content );
- $content(string) (required)
- Block content.
ProductCollectionNoResults::modify_anchor_tag_urls() ProductCollectionNoResults::modify anchor tag urls code WC 9.4.2
protected function modify_anchor_tag_urls( $content ) { $processor = new \WP_HTML_Tag_Processor( trim( $content ) ); // Set the URL attribute for the "clear any filters" link. if ( $processor->next_tag( array( 'tag_name' => 'a', 'class_name' => 'wc-link-clear-any-filters', ) ) ) { $processor->set_attribute( 'href', $this->get_current_url_without_filters() ); } // Set the URL attribute for the "Store's home" link. if ( $processor->next_tag( array( 'tag_name' => 'a', 'class_name' => 'wc-link-stores-home', ) ) ) { $processor->set_attribute( 'href', home_url() ); } return $processor->get_updated_html(); }