Commit realizado el 12:13:52 08-04-2024

This commit is contained in:
Pagina Web Monito
2024-04-08 12:13:55 -04:00
commit 0c33094de9
7815 changed files with 1365694 additions and 0 deletions

View File

@@ -0,0 +1,170 @@
<?php
/**
* The breadcrumb settings.
*
* @package RankMath
* @subpackage RankMath\Settings
*/
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
$args = [
'id' => 'breadcrumbs',
'type' => 'toggle',
'name' => esc_html__( 'Enable breadcrumbs function', 'rank-math' ),
'desc' => esc_html__( 'Turning off breadcrumbs will hide breadcrumbs inserted in template files too.', 'rank-math' ),
'default' => 'on',
];
if ( current_theme_supports( 'rank-math-breadcrumbs' ) ) {
$args['force_enable'] = true;
$args['disabled'] = true;
$args['desc'] = sprintf(
// Translators: Code to add support for Rank Math Breadcrumbs.
esc_html__( 'This option cannot be changed since your theme has added the support for Rank Math Breadcrumbs using: %s', 'rank-math' ),
"<br /><code>add_theme_support( 'rank-math-breadcrumbs' );</code>"
);
}
$cmb->add_field( $args );
$dependency = [ [ 'breadcrumbs', 'on' ] ];
$cmb->add_field(
[
'id' => 'breadcrumbs_separator',
'type' => 'radio_inline',
'name' => esc_html__( 'Separator Character', 'rank-math' ),
'desc' => esc_html__( 'Separator character or string that appears between breadcrumb items.', 'rank-math' ),
'options' => Helper::choices_separator( Helper::get_settings( 'general.breadcrumbs_separator' ) ),
'default' => '-',
'dep' => $dependency,
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_htmlentities' ],
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_home',
'type' => 'toggle',
'name' => esc_html__( 'Show Homepage Link', 'rank-math' ),
'desc' => wp_kses_post( __( 'Display homepage breadcrumb in trail.', 'rank-math' ) ),
'default' => 'on',
'dep' => $dependency,
]
);
$dependency_home = [ 'relation' => 'and' ] + $dependency;
$dependency_home[] = [ 'breadcrumbs_home', 'on' ];
$cmb->add_field(
[
'id' => 'breadcrumbs_home_label',
'type' => 'text',
'name' => esc_html__( 'Homepage label', 'rank-math' ),
'desc' => esc_html__( 'Label used for homepage link (first item) in breadcrumbs.', 'rank-math' ),
'default' => esc_html__( 'Home', 'rank-math' ),
'dep' => $dependency_home,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_home_link',
'type' => 'text',
'name' => esc_html__( 'Homepage Link', 'rank-math' ),
'desc' => esc_html__( 'Link to use for homepage (first item) in breadcrumbs.', 'rank-math' ),
'default' => get_home_url(),
'dep' => $dependency_home,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_prefix',
'type' => 'text',
'name' => esc_html__( 'Prefix Breadcrumb', 'rank-math' ),
'desc' => esc_html__( 'Prefix for the breadcrumb path.', 'rank-math' ),
'dep' => $dependency,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_archive_format',
'type' => 'text',
'name' => esc_html__( 'Archive Format', 'rank-math' ),
'desc' => esc_html__( 'Format the label used for archive pages.', 'rank-math' ),
/* translators: placeholder */
'default' => esc_html__( 'Archives for %s', 'rank-math' ),
'dep' => $dependency,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_search_format',
'type' => 'text',
'name' => esc_html__( 'Search Results Format', 'rank-math' ),
'desc' => esc_html__( 'Format the label used for search results pages.', 'rank-math' ),
/* translators: placeholder */
'default' => esc_html__( 'Results for %s', 'rank-math' ),
'dep' => $dependency,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_404_label',
'type' => 'text',
'name' => esc_html__( '404 label', 'rank-math' ),
'desc' => esc_html__( 'Label used for 404 error item in breadcrumbs.', 'rank-math' ),
'default' => esc_html__( '404 Error: page not found', 'rank-math' ),
'dep' => $dependency,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_remove_post_title',
'type' => 'toggle',
'name' => esc_html__( 'Hide Post Title', 'rank-math' ),
'desc' => wp_kses_post( __( 'Hide Post title from Breadcrumb.', 'rank-math' ) ),
'default' => 'off',
'dep' => $dependency,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_ancestor_categories',
'type' => 'toggle',
'name' => esc_html__( 'Show Category(s)', 'rank-math' ),
'desc' => esc_html__( 'If category is a child category, show all ancestor categories.', 'rank-math' ),
'default' => 'off',
'dep' => $dependency,
]
);
$cmb->add_field(
[
'id' => 'breadcrumbs_hide_taxonomy_name',
'type' => 'toggle',
'name' => esc_html__( 'Hide Taxonomy Name', 'rank-math' ),
'desc' => wp_kses_post( __( 'Hide Taxonomy Name from Breadcrumb.', 'rank-math' ) ),
'default' => 'off',
'dep' => $dependency,
]
);
if ( 'page' === get_option( 'show_on_front' ) && 0 < get_option( 'page_for_posts' ) ) {
$cmb->add_field(
[
'id' => 'breadcrumbs_blog_page',
'type' => 'toggle',
'name' => esc_html__( 'Show Blog Page', 'rank-math' ),
'desc' => esc_html__( 'Show Blog Page in Breadcrumb.', 'rank-math' ),
'default' => 'off',
'dep' => $dependency,
]
);
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* The htaccess settings.
*
* @package RankMath
* @subpackage RankMath\Settings
*/
use RankMath\Admin\Admin_Helper;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
$data = Admin_Helper::get_htaccess_data();
if ( false === $data ) {
$cmb->add_field(
[
'id' => 'htaccess_not_found',
'type' => 'notice',
'what' => 'error',
'content' => esc_html__( '.htaccess file not found.', 'rank-math' ),
]
);
return;
}
$attrs = [
'value' => $data['content'],
'readonly' => 'readonly',
'data-gramm' => 'false',
];
if ( ! $data['writable'] || ! Helper::is_edit_allowed() ) {
$cmb->add_field(
[
'id' => 'htaccess_not_writable',
'type' => 'notice',
'what' => 'error',
'content' => esc_html__( '.htaccess file is not writable.', 'rank-math' ),
]
);
} else {
$consent_checkbox = '<br><br><label><input type="checkbox" name="htaccess_accept_changes" id="htaccess_accept_changes" value="1"> <strong>' . esc_html__( 'I understand the risks and I want to edit the file', 'rank-math' ) . '</strong></label>';
$cmb->add_field(
[
'id' => 'htaccess_accept_changes',
'type' => 'notice',
'what' => 'error',
'content' => wp_kses_post( __( 'Be careful when editing the htaccess file, it is easy to make mistakes and break your site. If that happens, you can restore the file to its state <strong>before the last edit</strong> by replacing the htaccess file with the backup copy created by Rank Math in the same directory (<em>.htaccess_back_xxxxxx</em>) using an FTP client.', 'rank-math' ) ) . $consent_checkbox,
'classes' => 'rank-math-notice',
]
);
}
$cmb->add_field(
[
'id' => 'htaccess_content',
'type' => 'textarea',
'classes' => 'rank-math-code-box',
'save_field' => false,
'attributes' => $attrs,
]
);

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -0,0 +1,113 @@
<?php
/**
* The images settings.
*
* @package RankMath
* @subpackage RankMath\Settings
*/
use RankMath\Helper;
use RankMath\KB;
defined( 'ABSPATH' ) || exit;
$cmb->add_field(
[
'id' => 'strip_category_base',
'type' => 'toggle',
'name' => esc_html__( 'Strip Category Base', 'rank-math' ),
/* translators: Link to kb article */
'desc' => sprintf( wp_kses_post( __( 'Remove /category/ from category archive URLs. %s <br>E.g. <code>example.com/category/my-category/</code> becomes <code>example.com/my-category</code>', 'rank-math' ) ), '<a href="' . KB::get( 'remove-category-base', 'Options Panel Strip Category Base' ) . '" target="_blank">' . esc_html__( 'Why do this?', 'rank-math' ) . '</a>' ),
'classes' => 'rank-math-advanced-option',
'default' => 'off',
]
);
$redirection_message = Helper::is_module_active( 'redirections' ) ?
/* translators: Redirection page url */
' <a href="' . Helper::get_admin_url( 'options-general#setting-panel-redirections' ) . '" target="new">' . esc_html__( 'Redirection Manager', 'rank-math' ) . '</a>' :
'<span class="rank-math-tooltip">' . esc_html__( 'Redirections Manager', 'rank-math' ) . '<span>' . esc_html__( 'Please enable Redirections module.', 'rank-math' ) . '</span></span>';
$cmb->add_field(
[
'id' => 'attachment_redirect_urls',
'type' => 'toggle',
'name' => esc_html__( 'Redirect Attachments', 'rank-math' ),
/* translators: Link to kb article */
'desc' => sprintf( wp_kses_post( __( 'Redirect all attachment page URLs to the post they appear in. For more advanced redirection control, use the built-in %s.', 'rank-math' ) ), $redirection_message ),
'default' => 'on',
'classes' => 'rank-math-advanced-option',
]
);
$cmb->add_field(
[
'id' => 'attachment_redirect_default',
'type' => 'text',
'name' => esc_html__( 'Redirect Orphan Attachments', 'rank-math' ),
'desc' => esc_html__( 'Redirect attachments without a parent post to this URL. Leave empty for no redirection.', 'rank-math' ),
'classes' => 'rank-math-advanced-option',
'dep' => [ [ 'attachment_redirect_urls', 'on' ] ],
]
);
$cmb->add_field(
[
'id' => 'nofollow_external_links',
'type' => 'toggle',
'name' => esc_html__( 'Nofollow External Links', 'rank-math' ),
'desc' => wp_kses_post( __( 'Automatically add <code>rel="nofollow"</code> attribute for external links appearing in your posts, pages, and other post types. The attribute is dynamically applied when the content is displayed, and the stored content is not changed.', 'rank-math' ) ),
'default' => 'off',
'classes' => 'rank-math-advanced-option',
]
);
$cmb->add_field(
[
'id' => 'nofollow_image_links',
'type' => 'toggle',
'name' => esc_html__( 'Nofollow Image File Links', 'rank-math' ),
'desc' => wp_kses_post( __( 'Automatically add <code>rel="nofollow"</code> attribute for links pointing to external image files. The attribute is dynamically applied when the content is displayed, and the stored content is not changed.', 'rank-math' ) ),
'default' => 'off',
'classes' => 'rank-math-advanced-option',
]
);
$cmb->add_field(
[
'id' => 'nofollow_domains',
'type' => 'textarea_small',
'name' => esc_html__( 'Nofollow Domains', 'rank-math' ),
'desc' => wp_kses_post( __( 'Only add <code>nofollow</code> attribute for the link if target domain is in this list. Add one per line. Leave empty to apply nofollow for <strong>ALL</strong> external domains.', 'rank-math' ) ),
'classes' => 'rank-math-advanced-option',
'dep' => [
[ 'nofollow_external_links', 'on' ],
[ 'nofollow_image_links', 'on' ],
],
]
);
$cmb->add_field(
[
'id' => 'nofollow_exclude_domains',
'type' => 'textarea_small',
'name' => esc_html__( 'Nofollow Exclude Domains', 'rank-math' ),
'desc' => wp_kses_post( __( 'The <code>nofollow</code> attribute <strong>will not be added</strong> for the link if target domain is in this list. Add one per line.', 'rank-math' ) ),
'classes' => 'rank-math-advanced-option',
'dep' => [
[ 'nofollow_external_links', 'on' ],
[ 'nofollow_image_links', 'on' ],
],
]
);
$cmb->add_field(
[
'id' => 'new_window_external_links',
'type' => 'toggle',
'name' => esc_html__( 'Open External Links in New Tab/Window', 'rank-math' ),
'desc' => wp_kses_post( __( 'Automatically add <code>target="_blank"</code> attribute for external links appearing in your posts, pages, and other post types to make them open in a new browser tab or window. The attribute is dynamically applied when the content is displayed, and the stored content is not changed.', 'rank-math' ) ),
'default' => 'on',
]
);

View File

@@ -0,0 +1,120 @@
<?php
/**
* The misc settings.
*
* @package RankMath
* @subpackage RankMath\Settings
*/
use RankMath\KB;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
$cmb->add_field(
[
'id' => 'headless_support',
'type' => 'toggle',
'name' => esc_html__( 'Headless CMS Support', 'rank-math' ),
// Translators: placeholder is a link to "Read more".
'desc' => sprintf( esc_html__( 'Enable this option to register a REST API endpoint that returns the HTML meta tags for a given URL. %s', 'rank-math' ), '<a href="' . KB::get( 'headless-support', 'Others Tab KB Link' ) . '">' . esc_html__( 'Read more', 'rank-math' ) . '</a>' ),
'default' => 'off',
]
);
$cmb->add_field(
[
'id' => 'frontend_seo_score',
'type' => 'toggle',
'name' => esc_html__( 'Show SEO Score to Visitors', 'rank-math' ),
'desc' => esc_html__( 'Proudly display the calculated SEO Score as a badge on the front end. It can be disabled for specific posts in the post editor.', 'rank-math' ),
'default' => 'off',
]
);
$cmb->add_field(
[
'id' => 'frontend_seo_score_post_types',
'type' => 'multicheck',
'name' => esc_html__( 'SEO Score Post Types', 'rank-math' ),
'options' => Helper::choices_post_types(),
'default_cb' => '\\RankMath\\Frontend_SEO_Score::post_types_field_default',
'dep' => [ [ 'frontend_seo_score', 'on' ] ],
]
);
$cmb->add_field(
[
'id' => 'frontend_seo_score_template',
'type' => 'radio_inline',
'name' => esc_html__( 'SEO Score Template', 'rank-math' ),
'desc' => sprintf( esc_html__( 'Change the styling for the front end SEO score badge.', 'rank-math' ), '<code>nofollow</code>' ),
'options' => [
'circle' => esc_html__( 'Circle', 'rank-math' ),
'square' => esc_html__( 'Square', 'rank-math' ),
],
'default' => 'circle',
'dep' => [ [ 'frontend_seo_score', 'on' ] ],
]
);
$cmb->add_field(
[
'id' => 'frontend_seo_score_position',
'type' => 'radio_inline',
'name' => esc_html__( 'SEO Score Position', 'rank-math' ),
'desc' => sprintf(
/* translators: 1.SEO Score Shortcode 2. SEO Score function */
esc_html__( 'Display the badges automatically, or insert the %1$s shortcode in your posts and the %2$s template tag in your theme template files.', 'rank-math' ),
'<code>[rank_math_seo_score]</code>',
'<code>&lt;?php&nbsp;rank_math_the_seo_score();&nbsp;?&gt;</code>'
),
'classes' => 'nob',
'default' => 'top',
'options' => [
'bottom' => esc_html__( 'Below Content', 'rank-math' ),
'top' => esc_html__( 'Above Content', 'rank-math' ),
'both' => esc_html__( 'Above & Below Content', 'rank-math' ),
'custom' => esc_html__( 'Custom (use shortcode)', 'rank-math' ),
],
'dep' => [ [ 'frontend_seo_score', 'on' ] ],
]
);
$cmb->add_field(
[
'id' => 'support_rank_math',
'type' => 'toggle',
'name' => esc_html__( 'Support Us with a Link', 'rank-math' ),
/* Translators: %s is the word "nofollow" code tag and second one for the filter link */
'desc' => sprintf( esc_html__( 'If you are showing the SEO scores on the front end, this option will insert a %1$s backlink to RankMath.com to show your support. You can change the link & the text by using this %2$s.', 'rank-math' ), '<code>follow</code>', '<a href="' . KB::get( 'change-seo-score-backlink', 'Options Panel Support Us' ) . '" target="_blank">' . __( 'filter', 'rank-math' ) . '</a>' ),
'default' => 'on',
'dep' => [ [ 'frontend_seo_score', 'on' ] ],
]
);
$cmb->add_field(
[
'id' => 'rss_before_content',
'type' => 'textarea_small',
'name' => esc_html__( 'RSS Before Content', 'rank-math' ),
'desc' => esc_html__( 'Add content before each post in your site feeds.', 'rank-math' ),
]
);
$cmb->add_field(
[
'id' => 'rss_after_content',
'type' => 'textarea_small',
'name' => esc_html__( 'RSS After Content', 'rank-math' ),
'desc' => esc_html__( 'Add content after each post in your site feeds.', 'rank-math' ),
]
);
$cmb->add_field(
[
'id' => 'rank_math_rss_vars',
'type' => 'raw',
'file' => rank_math()->includes_dir() . 'settings/general/rss-vars-table.php',
]
);

View File

@@ -0,0 +1,47 @@
<?php
/**
* The webmaster variable template.
*
* @package RankMath
* @subpackage RankMath\Settings
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="cmb-row rank-math-rss-variables rank-math-exclude-from-search">
<h3><?php esc_html_e( 'Available variables', 'rank-math' ); ?> </h3>
<table class="wp-list-table widefat striped">
<thead>
<tr>
<th scope="col"> <?php esc_html_e( 'Variable', 'rank-math' ); ?></th>
<th scope="col"><?php esc_html_e( 'Description', 'rank-math' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>%AUTHORLINK%</td>
<td><?php esc_html_e( 'A link to the archive for the post author, with the authors name as anchor text.', 'rank-math' ); ?></td>
</tr>
<tr>
<td>%POSTLINK%</td>
<td><?php esc_html_e( 'A link to the post, with the title as anchor text.', 'rank-math' ); ?></td>
</tr>
<tr>
<td>%BLOGLINK%</td>
<td><?php esc_html_e( "A link to your site, with your site's name as anchor text.", 'rank-math' ); ?></td>
</tr>
<tr>
<td>%BLOGDESCLINK%</td>
<td><?php esc_html_e( "A link to your site, with your site's name and description as anchor text.", 'rank-math' ); ?></td>
</tr>
<tr>
<td>%FEATUREDIMAGE%</td>
<td><?php esc_html_e( 'Featured image of the article.', 'rank-math' ); ?></td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,100 @@
<?php
/**
* The webmaster settings.
*
* @package RankMath
* @subpackage RankMath\Settings
*/
defined( 'ABSPATH' ) || exit;
use RankMath\KB;
$cmb->add_field(
[
'id' => 'google_verify',
'type' => 'text',
'name' => esc_html__( 'Google Search Console', 'rank-math' ),
/* translators: Google Search Console Link */
'desc' => sprintf( esc_html__( 'Enter your Google Search Console verification HTML code or ID. Learn how to get it: %s', 'rank-math' ), '<a href="' . KB::get( 'google-verification-kb', 'Google Verification Tool' ) . '" target="_blank">' . esc_html__( 'Search Console Verification Page', 'rank-math' ) . '</a>' ) .
'<br><code>' . htmlspecialchars( '<meta name="google-site-verification" content="your-id" />' ) . '</code>',
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_webmaster_tags' ],
]
);
$cmb->add_field(
[
'id' => 'bing_verify',
'type' => 'text',
'name' => esc_html__( 'Bing Webmaster Tools', 'rank-math' ),
/* translators: Bing webmaster link */
'desc' => sprintf( esc_html__( 'Enter your Bing Webmaster Tools verification HTML code or ID. Get it here: %s', 'rank-math' ), '<a href="' . KB::get( 'bing-verification-kb', 'Bing Verification Tool' ) . '" target="_blank">' . esc_html__( 'Bing Webmaster Verification Page', 'rank-math' ) . '</a>' ) .
'<br><code>' . htmlspecialchars( '<meta name="msvalidate.01" content="your-id" />' ) . '</code>',
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_webmaster_tags' ],
]
);
$cmb->add_field(
[
'id' => 'baidu_verify',
'type' => 'text',
'name' => esc_html__( 'Baidu Webmaster Tools', 'rank-math' ),
/* translators: Baidu webmaster link */
'desc' => sprintf( esc_html__( 'Enter your Baidu Webmaster Tools verification HTML code or ID. Learn how to get it: %s', 'rank-math' ), '<a href="' . KB::get( 'baidu-verification-kb', 'Baidu Verification Tool' ) . '" target="_blank">' . esc_html__( 'Baidu Webmaster Tools', 'rank-math' ) . '</a>' ) .
'<br><code>' . htmlspecialchars( '<meta name="baidu-site-verification" content="your-id" />' ) . '</code>',
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_webmaster_tags' ],
]
);
$cmb->add_field(
[
'id' => 'yandex_verify',
'type' => 'text',
'name' => esc_html__( 'Yandex Verification ID', 'rank-math' ),
/* translators: Yandex webmaster link */
'desc' => sprintf( esc_html__( 'Enter your Yandex verification HTML code or ID. Learn how to get it: %s', 'rank-math' ), '<a href="' . KB::get( 'yandex-verification-kb', 'Yandex Verification Tool' ) . '" target="_blank">' . esc_html__( 'Yandex.Webmaster Page', 'rank-math' ) . '</a>' ) .
'<br><code>' . htmlspecialchars( '<meta name=\'yandex-verification\' content=\'your-id\' />' ) . '</code>',
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_webmaster_tags' ],
'classes' => 'rank-math-advanced-option',
]
);
$cmb->add_field(
[
'id' => 'pinterest_verify',
'type' => 'text',
'name' => esc_html__( 'Pinterest Verification ID', 'rank-math' ),
/* translators: Pinterest webmaster link */
'desc' => sprintf( esc_html__( 'Enter your Pinterest verification HTML code or ID. Learn how to get it: %s', 'rank-math' ), '<a href="' . KB::get( 'pinterest-verification-kb', 'Pinterest Verification Tool' ) . '" target="_blank">' . esc_html__( 'Pinterest Account', 'rank-math' ) . '</a>' ) .
'<br><code>' . htmlspecialchars( '<meta name="p:domain_verify" content="your-id" />' ) . '</code>',
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_webmaster_tags' ],
]
);
$cmb->add_field(
[
'id' => 'norton_verify',
'type' => 'text',
'name' => esc_html__( 'Norton Safe Web Verification ID', 'rank-math' ),
/* translators: Norton webmaster link */
'desc' => sprintf( esc_html__( 'Enter your Norton Safe Web verification HTML code or ID. Learn how to get it: %s', 'rank-math' ), '<a href="' . KB::get( 'norton-verification-kb', 'Norton Verification Tool' ) . '" target="_blank">' . esc_html__( 'Norton Ownership Verification Page', 'rank-math' ) . '</a>' ) .
'<br><code>' . htmlspecialchars( '<meta name="norton-safeweb-site-verification" content="your-id" />' ) . '</code>',
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_webmaster_tags' ],
'classes' => 'rank-math-advanced-option',
]
);
$cmb->add_field(
[
'id' => 'custom_webmaster_tags',
'type' => 'textarea',
'name' => esc_html__( 'Custom Webmaster Tags', 'rank-math' ),
'desc' => sprintf(
/* translators: %s: Allowed tags */
esc_html__( 'Enter your custom webmaster tags. Only %s tags are allowed.', 'rank-math' ),
'<code>&lt;meta&gt;</code>'
),
'sanitization_cb' => [ '\RankMath\CMB2', 'sanitize_custom_webmaster_tags' ],
'classes' => 'rank-math-advanced-option',
]
);

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -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,
]
);

View File

@@ -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',
]
);

View File

@@ -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' ),
]
);

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -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(),
]
);

View File

@@ -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',
]
);

View File

@@ -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' );
}

View File

@@ -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' ) ),
]
);

View File

@@ -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' );
}