rrent page is WooCommerce OnePage Checkout. if ( function_exists( 'is_wcopc_checkout' ) && is_wcopc_checkout() ) { return $robots; } if ( is_cart() || is_checkout() || is_account_page() ) { remove_action( 'wp_head', 'wc_page_noindex' ); return [ 'index' => 'noindex', 'follow' => 'follow', ]; } return $robots; } /** * Returns the meta description. Checks which value should be used when the given meta description is empty. * * It will use the short_description if that one is set. Otherwise it will use the full * product description limited to 156 characters. If everything is empty, it will return an empty string. * * @param string $metadesc The meta description to check. * * @return string The meta description. */ public function metadesc( $metadesc ) { if ( '' !== $metadesc || ! is_singular( 'product' ) || post_password_required() ) { return $metadesc; } $product = $this->get_product_by_id( get_the_id() ); if ( ! is_object( $product ) ) { return ''; } $short_desc = $this->get_short_description( $product ); if ( '' !== $short_desc ) { return $short_desc; } $long_desc = $this->get_long_description( $product ); return '' !== $long_desc ? Str::truncate( $long_desc, 156 ) : ''; } /** * Returns the product for given product_id. * * @param int $product_id The id to get the product for. * * @return null|WC_Product */ protected function get_product_by_id( $product_id ) { if ( function_exists( 'wc_get_product' ) ) { return wc_get_product( $product_id ); } if ( function_exists( 'get_product' ) ) { return get_product( $product_id ); } return null; } /** * Checks if product class has a description method. * Otherwise it returns the value of the post_content. * * @param WC_Product $product The product. * * @return string */ protected function get_long_description( $product ) { if ( post_password_required( $product->get_id() ) ) { return ''; } if ( method_exists( $product, 'get_description' ) ) { return $product->get_description(); } return $product->post->post_content; } /** * Update the values used for recalculating SEO score for products. * * @param array $values The values to be sent to the analyzer. * @param int $post_id The post ID. * * @return array */ public function recalculate_score_data( $values, $post_id ) { if ( 'product' === get_post_type( $post_id ) ) { $values['content'] = $values['content'] . ' ' . get_the_excerpt( $post_id ); } return $values; } } فروشگاه | بازرگانی لاستیک شریفی Skip to navigation Skip to main content
بازرگانی لاستیک شریفی، ارائه کننده انواع لاستیک و رینگ