Yoast\WP\SEO\Plans\User_Interface

Upgrade_Sidebar_Menu_Integration::add_pagepublicYoast 1.0

Adds the page to the (currently) last position in the array.

Метод класса: Upgrade_Sidebar_Menu_Integration{}

Хуков нет.

Возвращает

array<string,. array<string, array<static|string>>> The pages.

Использование

$Upgrade_Sidebar_Menu_Integration = new Upgrade_Sidebar_Menu_Integration();
$Upgrade_Sidebar_Menu_Integration->add_page( $pages );
$pages(обязательный)
.

Код Upgrade_Sidebar_Menu_Integration::add_page() Yoast 28.4

public function add_page( $pages ) {
	// Don't show the Upgrade button if Yoast SEO WooCommerce addon is active.
	if ( $this->addon_manager->is_installed( WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ) ) {
		return $pages;
	}

	// Don't show the Upgrade button if Premium is active without the WooCommerce plugin.
	if ( $this->product_helper->is_premium() && ! $this->woocommerce_conditional->is_met() ) {
		return $pages;
	}

	$button_content = \__( 'Upgrade', 'wordpress-seo' );

	if ( $this->promotion_manager->is( 'black-friday-promotion' ) ) {
		$button_content = ( $this->product_helper->is_premium() ) ? \__( 'Get 30% off', 'wordpress-seo' ) : \__( '30% off - BF Sale', 'wordpress-seo' );
	}

	$pages[] = [
		General_Page_Integration::PAGE,
		'',
		'<span class="yst-root"><span class="yst-button yst-w-full yst-whitespace-nowrap yst-button--upsell yst-button--small">' . $button_content . ' </span></span>',
		'edit_posts',
		self::PAGE,
		static function () {
			echo 'redirecting...';
		},
	];

	return $pages;
}