Yoast\WP\SEO\Alerts\Application\Default_SEO_Data
Default_SEO_Data_Alert::get_default_seo_data_message
Creates a message to inform users that they are using only default SEO data lately.
Метод класса: Default_SEO_Data_Alert{}
Хуков нет.
Возвращает
string. The default SEO data message.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_default_seo_data_message( $has_enough_posts_with_default_title, $has_enough_posts_with_default_desc ): string;
- $has_enough_posts_with_default_title(true|false) (обязательный)
- Whether there are content types with default SEO title in their most recent posts.
- $has_enough_posts_with_default_desc(true|false) (обязательный)
- Whether there are content types with default SEO description in their most recent posts.
Код Default_SEO_Data_Alert::get_default_seo_data_message() Default SEO Data Alert::get default seo data message Yoast 28.9
private function get_default_seo_data_message( $has_enough_posts_with_default_title, $has_enough_posts_with_default_desc ): string {
$shortlink = ( $this->product_helper->is_premium() ) ? $this->short_link_helper->get( 'https://yoa.st/ai-generate-alert-premium/' ) : $this->short_link_helper->get( 'https://yoa.st/ai-generate-alert-free/' );
if ( $has_enough_posts_with_default_title && $has_enough_posts_with_default_desc ) {
$default_seo_data = \esc_html__( 'SEO titles and meta descriptions', 'wordpress-seo' );
}
elseif ( $has_enough_posts_with_default_title ) {
$default_seo_data = \esc_html__( 'SEO titles', 'wordpress-seo' );
}
elseif ( $has_enough_posts_with_default_desc ) {
$default_seo_data = \esc_html__( 'meta descriptions', 'wordpress-seo' );
}
else {
$default_seo_data = \esc_html__( 'SEO data', 'wordpress-seo' );
}
/* translators: %1$s expands to "SEO title" or "meta description", %2$s expands to an opening link tag, %3$s expands to an opening strong tag, %4$s expands to a closing strong tag, %5$s expands to a closing link tag. */
$message = ( $this->product_helper->is_premium() ) ? \esc_html__( 'Your recent posts are using default %1$s, which can make them easy to overlook in search results. Update them manually or %2$sfind out how %3$sYoast AI Generate%4$s can improve them for you.%5$s', 'wordpress-seo' ) : \esc_html__( 'Your recent posts are using default %1$s, which can make them easy to overlook in search results. Update them for better visibility or %2$stry %3$sYoast AI Generate%4$s for free to do it faster.%5$s', 'wordpress-seo' );
return \sprintf(
$message,
$default_seo_data,
'<a href="' . \esc_url( $shortlink ) . '" target="_blank">',
'<strong>',
'</strong>',
'</a>',
);
}