Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* The authors settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$dep = [ [ 'disable_author_archives', 'off' ] ];
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'disable_author_archives',
|
||||
'type' => 'switch',
|
||||
'name' => esc_html__( 'Author Archives', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enables or disables Author Archives. If disabled, the Author Archives are redirected to your homepage. To avoid duplicate content issues, noindex author archives if you keep them enabled.', 'rank-math' ),
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Disabled', 'rank-math' ),
|
||||
'off' => esc_html__( 'Enabled', 'rank-math' ),
|
||||
],
|
||||
'default' => $this->do_filter( 'settings/titles/disable_author_archives', 'off' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'url_author_base',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Author Base', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'Change the <code>/author/</code> part in author archive URLs.', 'rank-math' ) ),
|
||||
'default' => 'author',
|
||||
'dep' => $dep,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_custom_robots',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Author Robots Meta', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'Select custom robots meta for author page, such as <code>nofollow</code>, <code>noarchive</code>, etc. Otherwise the default meta will be used, as set in the Global Meta tab.', 'rank-math' ) ),
|
||||
'options' => [
|
||||
'off' => esc_html__( 'Default', 'rank-math' ),
|
||||
'on' => esc_html__( 'Custom', 'rank-math' ),
|
||||
],
|
||||
'default' => 'on',
|
||||
'dep' => $dep,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_robots',
|
||||
'type' => 'multicheck',
|
||||
/* translators: post type name */
|
||||
'name' => esc_html__( 'Author Robots Meta', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Custom values for robots meta tag on author page.', 'rank-math' ),
|
||||
'options' => Helper::choices_robots(),
|
||||
'select_all_button' => false,
|
||||
'classes' => 'rank-math-advanced-option rank-math-robots-data',
|
||||
'dep' => [
|
||||
'relation' => 'and',
|
||||
[ 'author_custom_robots', 'on' ],
|
||||
[ 'disable_author_archives', 'off' ],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_advanced_robots',
|
||||
'type' => 'advanced_robots',
|
||||
'name' => esc_html__( 'Author Advanced Robots', 'rank-math' ),
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_advanced_robots' ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
'dep' => [
|
||||
'relation' => 'and',
|
||||
[ 'author_custom_robots', 'on' ],
|
||||
[ 'disable_author_archives', 'off' ],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_archive_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Author Archive Title', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Title tag on author archives. SEO options for specific authors can be set with the meta box available in the user profiles.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title rank-math-advanced-option',
|
||||
'default' => '%name% %sep% %sitename% %page%',
|
||||
'dep' => $dep,
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_archive_description',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Author Archive Description', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Author archive meta description. SEO options for specific author archives can be set with the meta box in the user profiles.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-description rank-math-advanced-option',
|
||||
'dep' => $dep,
|
||||
'attributes' => [
|
||||
'class' => 'cmb2-textarea-small wp-exclude-emoji',
|
||||
'data-gramm' => 'false',
|
||||
'rows' => 2,
|
||||
'data-exclude-variables' => 'seo_title,seo_description',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_slack_enhanced_sharing',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Slack Enhanced Sharing', 'rank-math' ),
|
||||
'desc' => esc_html__( 'When the option is enabled and an author archive is shared on Slack, additional information will be shown (name & total number of posts).', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
'dep' => $dep,
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'author_add_meta_box',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Add SEO Controls', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add SEO Controls for user profile pages. Access to the Meta Box can be fine tuned with code, using a special filter hook.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
'dep' => $dep,
|
||||
]
|
||||
);
|
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* The general settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'robots_global',
|
||||
'type' => 'multicheck',
|
||||
'name' => esc_html__( 'Robots Meta', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Default values for robots meta tag. These can be changed for individual posts, taxonomies, etc.', 'rank-math' ),
|
||||
'options' => Helper::choices_robots(),
|
||||
'default' => [ 'index' ],
|
||||
'classes' => 'rank-math-robots-data',
|
||||
'select_all_button' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'advanced_robots_global',
|
||||
'type' => 'advanced_robots',
|
||||
'name' => esc_html__( 'Advanced Robots Meta', 'rank-math' ),
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_advanced_robots' ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'noindex_empty_taxonomies',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Noindex Empty Category and Tag Archives', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'Setting empty archives to <code>noindex</code> is useful for avoiding indexation of thin content pages and dilution of page rank. As soon as a post is added, the page is updated to <code>index</code>.', 'rank-math' ) ),
|
||||
'default' => 'on',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'title_separator',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Separator Character', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'You can use the separator character in titles by inserting <code>%separator%</code> or <code>%sep%</code> in the title fields.', 'rank-math' ) ), // phpcs:ignore
|
||||
'options' => Helper::choices_separator( Helper::get_settings( 'titles.title_separator' ) ),
|
||||
'default' => '-',
|
||||
'attributes' => [ 'data-preview' => 'title' ],
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_separator' ],
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! current_theme_supports( 'title-tag' ) ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'rewrite_title',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Rewrite Titles', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Your current theme doesn\'t support title-tag. Enable this option to rewrite page, post, category, search and archive page titles.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'capitalize_titles',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Capitalize Titles', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Automatically capitalize the first character of each word in the titles.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'open_graph_image',
|
||||
'type' => 'file',
|
||||
'name' => esc_html__( 'OpenGraph Thumbnail', 'rank-math' ),
|
||||
'desc' => esc_html__( 'When a featured image or an OpenGraph Image is not set for individual posts/pages/CPTs, this image will be used as a fallback thumbnail when your post is shared on Facebook. The recommended image size is 1200 x 630 pixels.', 'rank-math' ),
|
||||
'options' => [ 'url' => false ],
|
||||
'class' => 'button-primary',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'twitter_card_type',
|
||||
'type' => 'select',
|
||||
'name' => esc_html__( 'Twitter Card Type', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Card type selected when creating a new post. This will also be applied for posts without a card type selected.', 'rank-math' ),
|
||||
'options' => [
|
||||
'summary_large_image' => esc_html__( 'Summary Card with Large Image', 'rank-math' ),
|
||||
'summary_card' => esc_html__( 'Summary Card', 'rank-math' ),
|
||||
],
|
||||
'default' => 'summary_large_image',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* The homepage/frontpage settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( 'page' === get_option( 'show_on_front' ) ) {
|
||||
$home_page_id = get_option( 'page_on_front' );
|
||||
if ( ! $home_page_id ) {
|
||||
$home_page_id = get_option( 'page_for_posts' );
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'static_homepage_notice',
|
||||
'type' => 'notice',
|
||||
'what' => 'warning',
|
||||
'content' => sprintf(
|
||||
/* translators: something */
|
||||
esc_html__( 'Static page is set as the front page (WP Dashboard > Settings > Reading). To add SEO title, description, and meta for the homepage, please click here: %s', 'rank-math' ),
|
||||
'<a href="' . admin_url( 'post.php?post=' . $home_page_id . '&action=edit' ) . '">' . esc_html__( 'Edit Page: ', 'rank-math' ) . get_the_title( $home_page_id ) . '</a>'
|
||||
),
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Homepage Title', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Homepage title tag.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title',
|
||||
'default' => '%sitename% %page% %sep% %sitedesc%',
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_description',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Homepage Meta Description', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Homepage meta description.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-description',
|
||||
'attributes' => [
|
||||
'class' => 'cmb2_textarea wp-exclude-emoji',
|
||||
'data-gramm' => 'false',
|
||||
'rows' => 2,
|
||||
'data-exclude-variables' => 'seo_title,seo_description',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_custom_robots',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Homepage Robots Meta', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'Select custom robots meta for homepage, such as <code>nofollow</code>, <code>noarchive</code>, etc. Otherwise the default meta will be used, as set in the Global Meta tab.', 'rank-math' ) ),
|
||||
'options' => [
|
||||
'off' => esc_html__( 'Default', 'rank-math' ),
|
||||
'on' => esc_html__( 'Custom', 'rank-math' ),
|
||||
],
|
||||
'default' => 'off',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_robots',
|
||||
'type' => 'multicheck',
|
||||
'name' => esc_html__( 'Homepage Robots Meta', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Custom values for robots meta tag on homepage.', 'rank-math' ),
|
||||
'options' => Helper::choices_robots(),
|
||||
'select_all_button' => false,
|
||||
'dep' => [ [ 'homepage_custom_robots', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option rank-math-robots-data',
|
||||
'default' => [ 'index' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_advanced_robots',
|
||||
'type' => 'advanced_robots',
|
||||
'name' => esc_html__( 'Homepage Advanced Robots', 'rank-math' ),
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_advanced_robots' ],
|
||||
'dep' => [ [ 'homepage_custom_robots', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_facebook_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Homepage Title for Facebook', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Title of your site when shared on Facebook, Twitter and other social networks.', 'rank-math' ),
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_facebook_description',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Homepage Description for Facebook', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Description of your site when shared on Facebook, Twitter and other social networks.', 'rank-math' ),
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'homepage_facebook_image',
|
||||
'type' => 'file',
|
||||
'name' => esc_html__( 'Homepage Thumbnail for Facebook', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Image displayed when your homepage is shared on Facebook and other social networks. Use images that are at least 1200 x 630 pixels for the best display on high resolution devices.', 'rank-math' ),
|
||||
]
|
||||
);
|
@@ -0,0 +1 @@
|
||||
<?php // Silence is golden.
|
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* The local SEO settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Local_Seo
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'knowledgegraph_type',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Person or Company', 'rank-math' ),
|
||||
'options' => [
|
||||
'person' => esc_html__( 'Person', 'rank-math' ),
|
||||
'company' => esc_html__( 'Organization', 'rank-math' ),
|
||||
],
|
||||
'desc' => esc_html__( 'Choose whether the site represents a person or an organization.', 'rank-math' ),
|
||||
'default' => 'person',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'website_name',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Website Name', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enter the name of your site to appear in search results.', 'rank-math' ),
|
||||
'default' => get_bloginfo( 'name' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'website_alternate_name',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Website Alternate Name', 'rank-math' ),
|
||||
'desc' => esc_html__( 'An alternate version of your site name (for example, an acronym or shorter name).', 'rank-math' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'knowledgegraph_name',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Person/Organization Name', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Your name or company name intended to feature in Google\'s Knowledge Panel.', 'rank-math' ),
|
||||
'default' => get_bloginfo( 'name' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'knowledgegraph_logo',
|
||||
'type' => 'file',
|
||||
'name' => esc_html__( 'Logo', 'rank-math' ),
|
||||
'desc' => __( '<strong>Min Size: 112Χ112px</strong>.<br /> A squared image is preferred by the search engines.', 'rank-math' ),
|
||||
'options' => [ 'url' => false ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'url',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'URL', 'rank-math' ),
|
||||
'desc' => esc_html__( 'URL of the item.', 'rank-math' ),
|
||||
'default' => home_url(),
|
||||
]
|
||||
);
|
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* The misc settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$dep = [ [ 'disable_date_archives', 'off' ] ];
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'disable_date_archives',
|
||||
'type' => 'switch',
|
||||
'name' => esc_html__( 'Date Archives', 'rank-math' ),
|
||||
'desc' => sprintf(
|
||||
// Translators: placeholder is an example URL.
|
||||
esc_html__( 'Enable or disable the date archives (e.g: %s). If this option is disabled, the date archives will be redirected to the homepage.', 'rank-math' ),
|
||||
'<code>domain.com/2019/06/</code>'
|
||||
),
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Disabled', 'rank-math' ),
|
||||
'off' => esc_html__( 'Enabled', 'rank-math' ),
|
||||
],
|
||||
'default' => 'on',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'date_archive_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Date Archive Title', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Title tag on day/month/year based archives.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title rank-math-advanced-option',
|
||||
'default' => '%date% %page% %sep% %sitename%',
|
||||
'dep' => $dep,
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'date_archive_description',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Date Archive Description', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Date archive description.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-description rank-math-advanced-option',
|
||||
'dep' => $dep,
|
||||
'attributes' => [
|
||||
'class' => 'cmb2-textarea-small wp-exclude-emoji',
|
||||
'data-gramm' => 'false',
|
||||
'rows' => 2,
|
||||
'data-exclude-variables' => 'seo_title,seo_description',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'date_archive_robots',
|
||||
'type' => 'multicheck',
|
||||
/* translators: post type name */
|
||||
'name' => esc_html__( 'Date Robots Meta', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Custom values for robots meta tag on date page.', 'rank-math' ),
|
||||
'options' => Helper::choices_robots(),
|
||||
'select_all_button' => false,
|
||||
'dep' => $dep,
|
||||
'classes' => 'rank-math-advanced-option rank-math-robots-data',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'date_advanced_robots',
|
||||
'type' => 'advanced_robots',
|
||||
'name' => esc_html__( 'Date Advanced Robots', 'rank-math' ),
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_advanced_robots' ],
|
||||
'dep' => $dep,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => '404_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( '404 Title', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Title tag on 404 Not Found error page.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title rank-math-advanced-option',
|
||||
'default' => 'Page Not Found %sep% %sitename%',
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'search_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Search Results Title', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Title tag on search results page.', 'rank-math' ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title rank-math-advanced-option',
|
||||
'default' => '%search_query% %page% %sep% %sitename%',
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'noindex_search',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Noindex Search Results', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Prevent search results pages from getting indexed by search engines. Search results could be considered to be thin content and prone to duplicate content issues.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'noindex_archive_subpages',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Noindex Subpages', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Prevent all paginated pages from getting indexed by search engines.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'noindex_paginated_pages',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Noindex Paginated Single Pages', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Prevent paginated pages of single pages and posts to show up in the search results. This also applies for the Blog page.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'noindex_password_protected',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Noindex Password Protected Pages', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Prevent password protected pages & posts from getting indexed by search engines.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
@@ -0,0 +1,410 @@
|
||||
<?php
|
||||
/**
|
||||
* The post type settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\KB;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$post_type = $tab['post_type'];
|
||||
if ( 'attachment' === $post_type && Helper::get_settings( 'general.attachment_redirect_urls', true ) ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'redirect_attachment_notice',
|
||||
'type' => 'notice',
|
||||
'what' => 'warning',
|
||||
/* translators: The settings page link */
|
||||
'content' => sprintf( __( 'To configure meta tags for your media attachment pages, you need to first %s to parent.', 'rank-math' ), '<a href="' . esc_url( Helper::get_admin_url( 'options-general#setting-panel-links' ) ) . '">' . esc_html__( 'disable redirect attachments', 'rank-math' ) . '</a>' ),
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$post_type_obj = get_post_type_object( $post_type );
|
||||
$name = $post_type_obj->labels->singular_name;
|
||||
|
||||
$custom_default = 'off';
|
||||
$richsnp_default = [
|
||||
'post' => 'article',
|
||||
'product' => 'product',
|
||||
];
|
||||
|
||||
if ( 'post' === $post_type || 'page' === $post_type ) {
|
||||
$custom_default = 'off';
|
||||
} elseif ( 'attachment' === $post_type ) {
|
||||
$custom_default = 'on';
|
||||
}
|
||||
|
||||
$primary_taxonomy_hash = [
|
||||
'post' => 'category',
|
||||
'product' => 'product_cat',
|
||||
];
|
||||
|
||||
$is_stories_post_type = defined( 'WEBSTORIES_VERSION' ) && 'web-story' === $post_type;
|
||||
|
||||
// Translators: Post type name.
|
||||
$slack_enhanced_sharing_description = sprintf( __( 'When the option is enabled and a %s is shared on Slack, additional information will be shown (estimated time to read and author).', 'rank-math' ), $name );
|
||||
if ( 'page' === $post_type ) {
|
||||
$slack_enhanced_sharing_description = __( 'When the option is enabled and a page is shared on Slack, additional information will be shown (estimated time to read).', 'rank-math' );
|
||||
} elseif ( 'product' === $post_type ) {
|
||||
$slack_enhanced_sharing_description = __( 'When the option is enabled and a product is shared on Slack, additional information will be shown (price & availability).', 'rank-math' );
|
||||
} elseif ( 'download' === $post_type ) {
|
||||
$slack_enhanced_sharing_description = __( 'When the option is enabled and a product is shared on Slack, additional information will be shown (price).', 'rank-math' );
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_title',
|
||||
'type' => 'text',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( 'Single %s Title', 'rank-math' ), $name ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( esc_html__( 'Default title tag for single %s pages. This can be changed on a per-post basis on the post editor screen.', 'rank-math' ), $name ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title',
|
||||
'default' => '%title% %page% %sep% %sitename%',
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_description',
|
||||
'type' => 'textarea_small',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( 'Single %s Description', 'rank-math' ), $name ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( esc_html__( 'Default description for single %s pages. This can be changed on a per-post basis on the post editor screen.', 'rank-math' ), $name ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-description',
|
||||
'default' => '%excerpt%',
|
||||
'attributes' => [
|
||||
'class' => 'cmb2-textarea-small wp-exclude-emoji',
|
||||
'data-gramm' => 'false',
|
||||
'rows' => 2,
|
||||
'data-exclude-variables' => 'seo_title,seo_description',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_archive_title',
|
||||
'type' => 'text',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( '%s Archive Title', 'rank-math' ), $name ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( esc_html__( 'Title for %s archive pages.', 'rank-math' ), $name ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title',
|
||||
'default' => '%title% %page% %sep% %sitename%',
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_archive_description',
|
||||
'type' => 'textarea_small',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( '%s Archive Description', 'rank-math' ), $name ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( esc_html__( 'Description for %s archive pages.', 'rank-math' ), $name ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-description',
|
||||
'attributes' => [
|
||||
'data-exclude-variables' => 'seo_title,seo_description',
|
||||
'rows' => 2,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
if ( ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) || ( class_exists( 'Easy_Digital_Downloads' ) && 'download' === $post_type ) ) {
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_default_rich_snippet',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Schema Type', 'rank-math' ),
|
||||
/* translators: link to title setting screen */
|
||||
'desc' => __( 'Default rich snippet selected when creating a new product.', 'rank-math' ),
|
||||
'options' => [
|
||||
'off' => esc_html__( 'None', 'rank-math' ),
|
||||
'product' => 'download' === $post_type ? esc_html__( 'EDD Product', 'rank-math' ) : esc_html__( 'WooCommerce Product', 'rank-math' ),
|
||||
],
|
||||
'default' => $this->do_filter( 'settings/snippet/type', 'product', $post_type ),
|
||||
]
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$schema_types = Helper::choices_rich_snippet_types( esc_html__( 'None (Click here to set one)', 'rank-math' ), $post_type );
|
||||
$type = 'select';
|
||||
$attributes = ! $is_stories_post_type ? [ 'data-s2' => '' ] : '';
|
||||
$default = isset( $richsnp_default[ $post_type ] ) ? $richsnp_default[ $post_type ] : 'off';
|
||||
|
||||
if ( 2 === count( $schema_types ) ) {
|
||||
$type = 'radio_inline';
|
||||
$attributes = '';
|
||||
$default = array_key_last( $schema_types );
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_default_rich_snippet',
|
||||
'type' => $type,
|
||||
'name' => esc_html__( 'Schema Type', 'rank-math' ),
|
||||
'desc' => sprintf(
|
||||
// Translators: %s is "Article" inside a <code> tag.
|
||||
esc_html__( 'Default rich snippet selected when creating a new post of this type. If %s is selected, it will be applied for all existing posts with no Schema selected.', 'rank-math' ),
|
||||
'<code>' . esc_html_x( 'Article', 'Schema type name in a field description', 'rank-math' ) . '</code>'
|
||||
),
|
||||
'options' => $is_stories_post_type ? [
|
||||
'off' => esc_html__( 'None', 'rank-math' ),
|
||||
'article' => esc_html__( 'Article', 'rank-math' ),
|
||||
] : $schema_types,
|
||||
'default' => $this->do_filter( 'settings/snippet/type', $default, $post_type ),
|
||||
'attributes' => $attributes,
|
||||
]
|
||||
);
|
||||
|
||||
// Common fields.
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_default_snippet_name',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Headline', 'rank-math' ),
|
||||
'dep' => [ [ 'pt_' . $post_type . '_default_rich_snippet', 'off', '!=' ] ],
|
||||
'classes' => 'rank-math-supports-variables rank-math-advanced-option',
|
||||
'default' => '%seo_title%',
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_default_snippet_desc',
|
||||
'type' => 'textarea',
|
||||
'name' => esc_html__( 'Description', 'rank-math' ),
|
||||
'attributes' => [
|
||||
'class' => 'cmb2_textarea wp-exclude-emoji',
|
||||
'rows' => 3,
|
||||
'data-autoresize' => true,
|
||||
],
|
||||
'classes' => 'rank-math-supports-variables rank-math-advanced-option',
|
||||
'default' => '%seo_description%',
|
||||
'dep' => [ [ 'pt_' . $post_type . '_default_rich_snippet', 'off,book,local', '!=' ] ],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Article fields.
|
||||
$article_dep = [ [ 'pt_' . $post_type . '_default_rich_snippet', 'article' ] ];
|
||||
/* translators: Google article snippet doc link */
|
||||
$article_desc = 'person' === Helper::get_settings( 'titles.knowledgegraph_type' ) ? '<div class="notice notice-warning inline rank-math-notice"><p>' . sprintf( __( 'Google does not allow Person as the Publisher for articles. Organization will be used instead. You can read more about this <a href="%s" target="_blank">here</a>.', 'rank-math' ), KB::get( 'google-article-schema' ) ) . '</p></div>' : '';
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_default_article_type',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Article Type', 'rank-math' ),
|
||||
'options' => [
|
||||
'Article' => esc_html__( 'Article', 'rank-math' ),
|
||||
'BlogPosting' => esc_html__( 'Blog Post', 'rank-math' ),
|
||||
'NewsArticle' => esc_html__( 'News Article', 'rank-math' ),
|
||||
],
|
||||
'default' => $this->do_filter( 'settings/snippet/article_type', 'post' === $post_type ? 'BlogPosting' : 'Article', $post_type ),
|
||||
'desc' => $article_desc,
|
||||
'dep' => $article_dep,
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_custom_robots',
|
||||
'type' => 'toggle',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( '%s Robots Meta', 'rank-math' ), $name ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( wp_kses_post( __( 'Select custom robots meta, such as <code>nofollow</code>, <code>noarchive</code>, etc. for single %s pages. Otherwise the default meta will be used, as set in the Global Meta tab.', 'rank-math' ) ), $name ),
|
||||
'options' => [
|
||||
'off' => esc_html__( 'Default', 'rank-math' ),
|
||||
'on' => esc_html__( 'Custom', 'rank-math' ),
|
||||
],
|
||||
'default' => $custom_default,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_robots',
|
||||
'type' => 'multicheck',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( '%s Robots Meta', 'rank-math' ), $name ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( esc_html__( 'Custom values for robots meta tag on %s.', 'rank-math' ), $name ),
|
||||
'options' => Helper::choices_robots(),
|
||||
'select_all_button' => false,
|
||||
'dep' => [ [ 'pt_' . $post_type . '_custom_robots', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option rank-math-robots-data',
|
||||
'default' => [ 'index' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_advanced_robots',
|
||||
'type' => 'advanced_robots',
|
||||
/* translators: post type name */
|
||||
'name' => sprintf( esc_html__( '%s Advanced Robots Meta', 'rank-math' ), $name ),
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_advanced_robots' ],
|
||||
'dep' => [ [ 'pt_' . $post_type . '_custom_robots', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_link_suggestions',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Link Suggestions', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enable Link Suggestions meta box for this post type, along with the Pillar Content feature.', 'rank-math' ),
|
||||
'default' => $this->do_filter( 'settings/titles/link_suggestions', 'on', $post_type ),
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_ls_use_fk',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Link Suggestion Titles', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Use the Focus Keyword as the default text for the links instead of the post titles.', 'rank-math' ),
|
||||
'options' => [
|
||||
'titles' => esc_html__( 'Titles', 'rank-math' ),
|
||||
'focus_keywords' => esc_html__( 'Focus Keywords', 'rank-math' ),
|
||||
],
|
||||
'default' => 'titles',
|
||||
'dep' => [ [ 'pt_' . $post_type . '_link_suggestions', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$taxonomies = Helper::get_object_taxonomies( $post_type );
|
||||
if ( $taxonomies ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_primary_taxonomy',
|
||||
'type' => 'select',
|
||||
'name' => esc_html__( 'Primary Taxonomy', 'rank-math' ),
|
||||
/* translators: post type name */
|
||||
'desc' => sprintf( esc_html__( 'Choose which taxonomy you want to use with the Primary Term feature. This will also be the taxonomy shown in the Breadcrumbs when a single %1$s is being viewed.', 'rank-math' ), $name ),
|
||||
'options' => $taxonomies,
|
||||
'default' => isset( $primary_taxonomy_hash[ $post_type ] ) ? $primary_taxonomy_hash[ $post_type ] : 'off',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_facebook_image',
|
||||
'type' => 'file',
|
||||
'name' => esc_html__( 'Thumbnail for Facebook', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Image displayed when your page is shared on Facebook and other social networks. Use images that are at least 1200 x 630 pixels for the best display on high resolution devices.', 'rank-math' ),
|
||||
]
|
||||
);
|
||||
|
||||
// Enable/Disable Metabox option.
|
||||
if ( 'attachment' === $post_type ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_bulk_editing',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Bulk Editing', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add bulk editing columns to the post listing screen.', 'rank-math' ),
|
||||
'options' => [
|
||||
'0' => esc_html__( 'Disabled', 'rank-math' ),
|
||||
'editing' => esc_html__( 'Enabled', 'rank-math' ),
|
||||
'readonly' => esc_html__( 'Read Only', 'rank-math' ),
|
||||
],
|
||||
'default' => 'editing',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_slack_enhanced_sharing',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Slack Enhanced Sharing', 'rank-math' ),
|
||||
'desc' => esc_html( $slack_enhanced_sharing_description ),
|
||||
'default' => in_array( $post_type, [ 'post', 'page', 'product', 'download' ], true ) ? 'on' : 'off',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_add_meta_box',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Add SEO Controls', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add SEO controls for the editor screen to customize SEO options for posts in this post type.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_bulk_editing',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Bulk Editing', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add bulk editing columns to the post listing screen.', 'rank-math' ),
|
||||
'options' => [
|
||||
'0' => esc_html__( 'Disabled', 'rank-math' ),
|
||||
'editing' => esc_html__( 'Enabled', 'rank-math' ),
|
||||
'readonly' => esc_html__( 'Read Only', 'rank-math' ),
|
||||
],
|
||||
'default' => 'editing',
|
||||
'dep' => [ [ 'pt_' . $post_type . '_add_meta_box', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'pt_' . $post_type . '_analyze_fields',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Custom Fields', 'rank-math' ),
|
||||
'desc' => esc_html__( 'List of custom fields name to include in the Page analysis. Add one per line.', 'rank-math' ),
|
||||
'default' => '',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Archive not enabled.
|
||||
if ( ! $post_type_obj->has_archive ) {
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_archive_title' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_archive_description' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_facebook_image' );
|
||||
}
|
||||
|
||||
if ( 'attachment' === $post_type ) {
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_link_suggestions' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_ls_use_fk' );
|
||||
}
|
||||
|
||||
if ( $is_stories_post_type ) {
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_default_snippet_desc' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_description' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_link_suggestions' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_ls_use_fk' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_analyze_fields' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_bulk_editing' );
|
||||
$cmb->remove_field( 'pt_' . $post_type . '_add_meta_box' );
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* The social settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use RankMath\KB;
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'social_url_facebook',
|
||||
'type' => 'text_url',
|
||||
'name' => esc_html__( 'Facebook Page URL', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enter your complete Facebook page URL here. eg:', 'rank-math' ) .
|
||||
'<br><code>' . htmlspecialchars( 'https://www.facebook.com/RankMath/' ) . '</code>',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'facebook_author_urls',
|
||||
'type' => 'text_url',
|
||||
'name' => esc_html__( 'Facebook Authorship', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Insert personal Facebook profile URL to show Facebook Authorship when your articles are being shared on Facebook. eg:', 'rank-math' ) .
|
||||
'<br><code>' . htmlspecialchars( 'https://www.facebook.com/zuck' ) . '</code>',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'facebook_admin_id',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Facebook Admin', 'rank-math' ),
|
||||
/* translators: numeric user ID link */
|
||||
'desc' => sprintf( esc_html__( 'Enter %s. Use a comma to separate multiple IDs. Alternatively, you can enter an app ID below.', 'rank-math' ), '<a href="https://lookup-id.com/?utm_campaign=Rank+Math" target="_blank">numeric user ID</a>' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'facebook_app_id',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Facebook App', 'rank-math' ),
|
||||
/* translators: numeric app ID link */
|
||||
'desc' => sprintf( esc_html__( 'Enter %s. Alternatively, you can enter a user ID above.', 'rank-math' ), '<a href="https://developers.facebook.com/apps?utm_campaign=Rank+Math" target="_blank">numeric app ID</a>' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'facebook_secret',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Facebook Secret', 'rank-math' ),
|
||||
/* translators: Learn more link */
|
||||
'desc' => sprintf( esc_html__( 'Enter alphanumeric secret ID. %s.', 'rank-math' ), '<a href="' . KB::get( 'create-facebook-app' ) . '" target="_blank">Learn more</a>' ),
|
||||
'attributes' => [ 'type' => 'password' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'social_url_facebook',
|
||||
'type' => 'text_url',
|
||||
'name' => esc_html__( 'Facebook Page URL', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enter your complete Facebook page URL here. eg:', 'rank-math' ) .
|
||||
'<br><code>' . htmlspecialchars( 'https://www.facebook.com/RankMath/' ) . '</code>',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'twitter_author_names',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Twitter Username', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'Enter the Twitter username of the author to add <code>twitter:creator</code> tag to posts. eg: <code>RankMathSEO</code>', 'rank-math' ) ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'social_additional_profiles',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Additional Profiles', 'rank-math' ),
|
||||
'desc' => wp_kses_post( __( 'Additional Profiles to add in the <code>sameAs</code> Schema property.', 'rank-math' ) ),
|
||||
]
|
||||
);
|
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* The taxonomies settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Settings
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$taxonomy = $tab['taxonomy'];
|
||||
$taxonomy_obj = get_taxonomy( $taxonomy );
|
||||
$name = $taxonomy_obj->labels->singular_name;
|
||||
|
||||
$metabox_default = 'off';
|
||||
$custom_default = 'off';
|
||||
$remove_snippet_default = in_array( $taxonomy, [ 'product_cat', 'product_tag' ], true ) || substr( $taxonomy, 0, 3 ) === 'pa_' ? 'on' : 'off';
|
||||
|
||||
if ( 'category' === $taxonomy ) {
|
||||
$metabox_default = 'on';
|
||||
$custom_default = 'off';
|
||||
} elseif ( 'post_tag' === $taxonomy ) {
|
||||
$metabox_default = 'off';
|
||||
$custom_default = 'on';
|
||||
} elseif ( 'post_format' === $taxonomy ) {
|
||||
$custom_default = 'on';
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_title',
|
||||
'type' => 'text',
|
||||
/* translators: taxonomy name */
|
||||
'name' => sprintf( esc_html__( '%s Archive Titles', 'rank-math' ), $name ),
|
||||
/* translators: taxonomy name */
|
||||
'desc' => sprintf( esc_html__( 'Title tag for %s archives', 'rank-math' ), $name ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-title',
|
||||
'default' => '%term% Archives %page% %sep% %sitename%',
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_textfield' ],
|
||||
'attributes' => [ 'data-exclude-variables' => 'seo_title,seo_description' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_description',
|
||||
'type' => 'textarea_small',
|
||||
/* translators: taxonomy name */
|
||||
'name' => sprintf( esc_html__( '%s Archive Descriptions', 'rank-math' ), $name ),
|
||||
/* translators: taxonomy name */
|
||||
'desc' => sprintf( esc_html__( 'Description for %s archives', 'rank-math' ), $name ),
|
||||
'classes' => 'rank-math-supports-variables rank-math-description',
|
||||
'attributes' => [
|
||||
'class' => 'cmb2-textarea-small wp-exclude-emoji',
|
||||
'data-gramm' => 'false',
|
||||
'rows' => 2,
|
||||
'data-exclude-variables' => 'seo_title,seo_description',
|
||||
],
|
||||
'default' => '%term_description%',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_custom_robots',
|
||||
'type' => 'toggle',
|
||||
/* translators: taxonomy name */
|
||||
'name' => sprintf( esc_html__( '%s Archives Robots Meta', 'rank-math' ), $name ),
|
||||
/* translators: taxonomy name */
|
||||
'desc' => sprintf( wp_kses_post( __( 'Select custom robots meta, such as <code>nofollow</code>, <code>noarchive</code>, etc. for %s archive pages. Otherwise the default meta will be used, as set in the Global Meta tab.', 'rank-math' ) ), strtolower( $name ) ),
|
||||
'options' => [
|
||||
'off' => esc_html__( 'Default', 'rank-math' ),
|
||||
'on' => esc_html__( 'Custom', 'rank-math' ),
|
||||
],
|
||||
'default' => $custom_default,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_robots',
|
||||
'type' => 'multicheck',
|
||||
/* translators: taxonomy name */
|
||||
'name' => sprintf( esc_html__( '%s Archives Robots Meta', 'rank-math' ), $name ),
|
||||
/* translators: taxonomy name */
|
||||
'desc' => sprintf( esc_html__( 'Custom values for robots meta tag on %s archives.', 'rank-math' ), $name ),
|
||||
'options' => Helper::choices_robots(),
|
||||
'select_all_button' => false,
|
||||
'dep' => [ [ 'tax_' . $taxonomy . '_custom_robots', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option rank-math-robots-data',
|
||||
'default' => [ 'index' ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_advanced_robots',
|
||||
'type' => 'advanced_robots',
|
||||
/* translators: taxonomy name */
|
||||
'name' => sprintf( esc_html__( '%s Archives Advanced Robots Meta', 'rank-math' ), $name ),
|
||||
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_advanced_robots' ],
|
||||
'dep' => [ [ 'tax_' . $taxonomy . '_custom_robots', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_slack_enhanced_sharing',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Slack Enhanced Sharing', 'rank-math' ),
|
||||
'desc' => esc_html__( 'When the option is enabled and a term from this taxonomy is shared on Slack, additional information will be shown (the total number of items with this term).', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'tax_' . $taxonomy . '_add_meta_box',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Add SEO Controls', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add the SEO Controls for the term editor screen to customize SEO options for individual terms in this taxonomy.', 'rank-math' ),
|
||||
'default' => $metabox_default,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'remove_' . $taxonomy . '_snippet_data',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Remove Snippet Data', 'rank-math' ),
|
||||
/* translators: taxonomy name */
|
||||
'desc' => sprintf( esc_html__( 'Remove schema data from %s.', 'rank-math' ), $name ),
|
||||
'default' => $remove_snippet_default,
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
if ( 'post_format' === $taxonomy ) {
|
||||
$cmb->remove_field( 'tax_' . $taxonomy . '_add_meta_box' );
|
||||
$cmb->remove_field( 'remove_' . $taxonomy . '_snippet_data' );
|
||||
}
|
Reference in New Issue
Block a user