summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/wordads/php/params.php')
-rw-r--r--plugins/jetpack/modules/wordads/php/params.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/jetpack/modules/wordads/php/params.php b/plugins/jetpack/modules/wordads/php/params.php
index 70ed4149..9ec48911 100644
--- a/plugins/jetpack/modules/wordads/php/params.php
+++ b/plugins/jetpack/modules/wordads/php/params.php
@@ -148,6 +148,35 @@ class WordAds_Params {
}
/**
+ * @return int The page type code for ipw config
+ *
+ * @since 5.6.0
+ */
+ public function get_page_type_ipw() {
+ if ( ! empty( $this->page_type_ipw ) ) {
+ return $this->page_type_ipw;
+ }
+
+ $page_type_ipw = 6;
+ if ( self::is_static_home() || is_home() || is_front_page() ) {
+ $page_type_ipw = 0;
+ } else if ( is_page() ) {
+ $page_type_ipw = 2;
+ } else if ( is_singular() ) {
+ $page_type_ipw = 1;
+ } else if ( is_search() ) {
+ $page_type_ipw = 4;
+ } else if ( is_category() || is_tag() || is_archive() || is_author() ) {
+ $page_type_ipw = 3;
+ } else if ( is_404() ) {
+ $page_type_ipw = 5;
+ }
+
+ $this->page_type_ipw = $page_type_ipw;
+ return $page_type_ipw;
+ }
+
+ /**
* Returns true if page is static home
* @return boolean true if page is static home
*