1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
namespace Yoast\WP\SEO\Helpers;
/** * Represents helper methods for WooCommerce. */ class Woocommerce_Helper {
/** * Checks if WooCommerce is active. * * @return bool Is WooCommerce active. */ public function is_active() { return \class_exists( 'WooCommerce' ); }
/** * Returns the id of the set WooCommerce shop page. * * @return int The ID of the set page. */ public function get_shop_page_id() { if ( ! \function_exists( 'wc_get_page_id' ) ) { return -1; }
return \wc_get_page_id( 'shop' ); }
/** * Checks if the current page is a WooCommerce shop page. * * @return bool True when the page is a shop page. */ public function is_shop_page() { if ( ! \function_exists( 'is_shop' ) ) { return false; }
if ( ! \is_shop() ) { return false; }
if ( \is_search() ) { return false; }
return true; } }
|