Jetpack_SEO_Utils::is_enabled_jetpack_seo PHP Method

is_enabled_jetpack_seo() public static method

Used to check whether SEO tools are enabled for given site.
public static is_enabled_jetpack_seo ( integer $site_id ) : boolean
$site_id integer Optional. Defaults to current blog id if not given.
return boolean True if SEO tools are enabled, false otherwise.
    public static function is_enabled_jetpack_seo($site_id = 0)
    {
        if (function_exists('has_blog_sticker')) {
            // For WPCOM sites
            if (empty($site_id)) {
                $site_id = get_current_blog_id();
            }
            return has_blog_sticker('unlimited-premium-themes', $site_id);
        }
        // For all Jetpack sites
        return true;
    }

Usage Example

コード例 #1
0
 /**
  * Used to modify the default title with custom SEO title.
  *
  * @param string $default_title Default title for current page.
  *
  * @return string Custom title with replaced tokens or default title.
  */
 public static function get_custom_title($default_title = '')
 {
     // Don't filter title for unsupported themes.
     if (self::is_conflicted_theme()) {
         return $default_title;
     }
     $page_type = self::get_page_type();
     // Keep default title if invalid page type is supplied.
     if (empty($page_type)) {
         return $default_title;
     }
     $title_formats = self::get_custom_title_formats();
     // Keep default title if user has not defined custom title for this page type.
     if (empty($title_formats[$page_type])) {
         return $default_title;
     }
     if (!Jetpack_SEO_Utils::is_enabled_jetpack_seo()) {
         return $default_title;
     }
     $custom_title = '';
     $format_array = $title_formats[$page_type];
     foreach ($format_array as $item) {
         if ('token' == $item['type']) {
             $custom_title .= self::get_token_value($item['value']);
         } else {
             $custom_title .= $item['value'];
         }
     }
     return esc_html($custom_title);
 }
All Usage Examples Of Jetpack_SEO_Utils::is_enabled_jetpack_seo