WPSEO_Admin_Banner_Spot::add_banner PHP Method

add_banner() public method

Adds an admin banner.
public add_banner ( WPSEO_Admin_Banner $banner )
$banner WPSEO_Admin_Banner The banner to add.
    public function add_banner(WPSEO_Admin_Banner $banner)
    {
        $this->banners[] = $banner;
    }

Usage Example

コード例 #1
0
 /**
  * Returns two random selected plugin banners.
  *
  * @return WPSEO_Admin_Banner_Spot
  */
 private function get_plugin_banners()
 {
     $plugin_banners = new WPSEO_Admin_Banner_Spot(__('Extensions', 'wordpress-seo'), sprintf(__('Extend your %1$s plugin with our %2$sSEO plugins%3$s.', 'wordpress-seo'), 'Yoast SEO', '<a href="https://yoa.st/">', '</a>'));
     $plugin_banners->add_banner(new WPSEO_Admin_Banner('https://yoast.com/wordpress/plugins/seo-premium/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=premium-seo-banner', 'banner-premium-seo.png', 261, 152, __('Buy the Yoast SEO Premium plugin now and get access to extra features and 24/7 support!', 'wordpress-seo')));
     if (!class_exists('wpseo_Video_Sitemap')) {
         $plugin_banners->add_banner(new WPSEO_Admin_Banner('https://yoast.com/wordpress/plugins/video-seo/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=video-seo-banner', 'banner-video-seo.png', 261, 152, __('Buy the Yoast Video SEO plugin now and optimize your videos for video search results and social media!', 'wordpress-seo')));
     }
     if (class_exists('Woocommerce') && !class_exists('Yoast_WooCommerce_SEO')) {
         $plugin_banners->add_banner(new WPSEO_Admin_Banner('https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=woocommerce-seo-banner', 'banner-woocommerce-seo.png', 261, 152, __('Buy the Yoast WooCommerce SEO plugin now and optimize your shop today to improve your product promotion!', 'wordpress-seo')));
     }
     if (!defined('WPSEO_LOCAL_VERSION')) {
         $plugin_banners->add_banner(new WPSEO_Admin_Banner('https://yoast.com/wordpress/plugins/local-seo/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=local-seo-banner', 'banner-local-seo.png', 261, 152, __('Buy the Yoast Local SEO plugin now to improve your site&#8217;s Local SEO and ranking in Google Maps!', 'wordpress-seo')));
     }
     if (!class_exists('WPSEO_News')) {
         $plugin_banners->add_banner(new WPSEO_Admin_Banner('https://yoast.com/wordpress/plugins/news-seo/#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=news-seo-banner', 'banner-news-seo.png', 261, 152, __('Buy the Yoast News SEO plugin now and start optimizing to get your site featured in Google News!', 'wordpress-seo')));
     }
     return $plugin_banners;
 }
All Usage Examples Of WPSEO_Admin_Banner_Spot::add_banner