Yoast\WP\SEO\Integrations\Third_Party
WooCommerce::canonical() public Yoast 1.0
Returns the correct canonical when WooCommerces is enabled.
{} Это метод класса: WooCommerce{}
Хуков нет.
Возвращает
Строку
. The correct canonical.
Использование
$WooCommerce = new WooCommerce(); $WooCommerce->canonical( $canonical, $presentation );
- $canonical(строка) (обязательный)
- The current canonical.
- $presentation(Indexable_Presentation/null)
- The indexable presentation.
Код WooCommerce::canonical() WooCommerce::canonical Yoast 16.1.1
public function canonical( $canonical, $presentation = null ) {
if ( ! $this->is_shop_page() ) {
return $canonical;
}
$presentation = $this->ensure_presentation( $presentation );
$permalink = $presentation->get_permalink();
if ( ! $permalink ) {
return $canonical;
}
$current_page = $this->pagination_helper->get_current_archive_page_number();
if ( $current_page > 1 ) {
return $this->pagination_helper->get_paginated_url( $permalink, $current_page );
}
return $permalink;
}