Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Sitemap settings - Authors tab.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Sitemap
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$roles = Helper::get_roles();
|
||||
$default = $roles;
|
||||
unset( $default['administrator'], $default['editor'], $default['author'] );
|
||||
|
||||
$dep = [
|
||||
'relation' => 'OR',
|
||||
[ 'authors_sitemap', 'on' ],
|
||||
[ 'authors_html_sitemap', 'on' ],
|
||||
];
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'authors_sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include in Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include author archives in the XML sitemap.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'authors_html_sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include in HTML Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include author archives in the HTML sitemap if it\'s enabled.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'classes' => [
|
||||
'rank-math-html-sitemap',
|
||||
! Helper::get_settings( 'sitemap.html_sitemap' ) ? 'hidden' : '',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'exclude_roles',
|
||||
'type' => 'multicheck',
|
||||
'name' => esc_html__( 'Exclude User Roles', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Selected roles will be excluded from the XML & HTML sitemaps.', 'rank-math' ),
|
||||
'options' => $roles,
|
||||
'default' => $default,
|
||||
'select_all_button' => false,
|
||||
'dep' => $dep,
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'exclude_users',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Exclude Users', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add user IDs, separated by commas, to exclude them from the sitemap.', 'rank-math' ),
|
||||
'dep' => $dep,
|
||||
]
|
||||
);
|
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Sitemap settings - General tab.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Sitemap
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'SitePress' ) ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'multilingual_sitemap_notice',
|
||||
'type' => 'notice',
|
||||
'what' => 'warning',
|
||||
'content' => sprintf(
|
||||
/* translators: hreflang tags documentation link */
|
||||
esc_html__( 'Rank Math generates the default Sitemaps only and WPML takes care of the rest. When a search engine bot visits any post/page, it is shown hreflang tag that helps it crawl the translated pages. This is one of the recommended methods by Google. Please %s', 'rank-math' ),
|
||||
'<a href="https://support.google.com/webmasters/answer/189077?hl=en" target="blank">' . esc_html__( 'read here', 'rank-math' ) . '</a>'
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'items_per_page',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Links Per Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Max number of links on each sitemap page.', 'rank-math' ),
|
||||
'default' => '200',
|
||||
'attributes' => [ 'type' => 'number' ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'include_images',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Images in Sitemaps', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include reference to images from the post content in sitemaps. This helps search engines index the important images on your pages.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'include_featured_image',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include Featured Images', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include the Featured Image too, even if it does not appear directly in the post content.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
'dep' => [ [ 'include_images', 'on' ] ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'exclude_posts',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Exclude Posts', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enter post IDs of posts you want to exclude from the sitemap, separated by commas. This option **applies** to all posts types including posts, pages, and custom post types.', 'rank-math' ),
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'exclude_terms',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Exclude Terms', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Add term IDs, separated by comma. This option is applied for all taxonomies.', 'rank-math' ),
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* Sitemap settings - HTML Sitemap tab.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Sitemap
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'HTML Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Enable the HTML sitemap.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap_display',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Display Format', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Choose how you want to display the HTML sitemap.', 'rank-math' ),
|
||||
'options' => [
|
||||
'shortcode' => esc_html__( 'Shortcode', 'rank-math' ),
|
||||
'page' => esc_html__( 'Page', 'rank-math' ),
|
||||
],
|
||||
'default' => 'shortcode',
|
||||
'dep' => [ [ 'html_sitemap', 'on' ] ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap_shortcode',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Shortcode', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Use this shortcode to display the HTML sitemap.', 'rank-math' ),
|
||||
'default' => '[rank_math_html_sitemap]',
|
||||
'dep' => [
|
||||
'relation' => 'AND',
|
||||
[ 'html_sitemap', 'on' ],
|
||||
[ 'html_sitemap_display', 'shortcode' ],
|
||||
],
|
||||
'classes' => 'rank-math-code',
|
||||
'attributes' => [
|
||||
'disabled' => 'disabled',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$rank_math_sitemap_page = Helper::get_settings( 'sitemap.html_sitemap_page' );
|
||||
$rank_math_sitemap_page_options = [ '' => __( 'Select Page', 'rank-math' ) ];
|
||||
$rank_math_sitemap_page_after = '<p class="rank-math-selected-page-message hidden">' . esc_html__( 'Selected page: ', 'rank-math' ) . '<span class="rank-math-selected-page"></span></p>';
|
||||
|
||||
if ( $rank_math_sitemap_page ) {
|
||||
$rank_math_sitemap_page_options[ $rank_math_sitemap_page ] = get_the_title( $rank_math_sitemap_page );
|
||||
|
||||
$rank_math_sitemap_page_after = '<p class="rank-math-selected-page-message">' . sprintf(
|
||||
/* translators: link to the selected page */
|
||||
__( 'Selected page: <a href="%s" target="_blank" class="rank-math-selected-page">%s</a>', 'rank-math' ), // phpcs:ignore
|
||||
get_permalink( $rank_math_sitemap_page ),
|
||||
get_permalink( $rank_math_sitemap_page )
|
||||
) . '</p>';
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap_page',
|
||||
'type' => 'select',
|
||||
'name' => esc_html__( 'Page', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Select the page to display the HTML sitemap. Once the settings are saved, the sitemap will be displayed below the content of the selected page.', 'rank-math' ),
|
||||
'options' => $rank_math_sitemap_page_options,
|
||||
'dep' => [
|
||||
'relation' => 'AND',
|
||||
[ 'html_sitemap', 'on' ],
|
||||
[ 'html_sitemap_display', 'page' ],
|
||||
],
|
||||
'after' => $rank_math_sitemap_page_after,
|
||||
'attributes' => [
|
||||
'data-placeholder' => esc_html__( 'Select a page', 'rank-math' ),
|
||||
'data-s2-pages' => 'true',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap_sort',
|
||||
'type' => 'select',
|
||||
'name' => esc_html__( 'Sort By', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Choose how you want to sort the items in the HTML sitemap.', 'rank-math' ),
|
||||
'options' => [
|
||||
// Published Date, Modified Date, Alphabetical, Post ID.
|
||||
'published' => esc_html__( 'Published Date', 'rank-math' ),
|
||||
'modified' => esc_html__( 'Modified Date', 'rank-math' ),
|
||||
'alphabetical' => esc_html__( 'Alphabetical', 'rank-math' ),
|
||||
'post_id' => esc_html__( 'Post ID', 'rank-math' ),
|
||||
],
|
||||
'default' => 'published',
|
||||
'dep' => [ [ 'html_sitemap', 'on' ] ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap_show_dates',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Show Dates', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Show published dates for each post & page.', 'rank-math' ),
|
||||
'default' => 'on',
|
||||
'dep' => [ [ 'html_sitemap', 'on' ] ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'html_sitemap_seo_titles',
|
||||
'type' => 'radio_inline',
|
||||
'name' => esc_html__( 'Item Titles', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Show the post/term titles, or the SEO titles in the HTML sitemap.', 'rank-math' ),
|
||||
'options' => [
|
||||
'titles' => esc_html__( 'Item Titles', 'rank-math' ),
|
||||
'seo_titles' => esc_html__( 'SEO Titles', 'rank-math' ),
|
||||
],
|
||||
'dep' => [ [ 'html_sitemap', 'on' ] ],
|
||||
'default' => 'titles',
|
||||
]
|
||||
);
|
@@ -0,0 +1 @@
|
||||
<?php // Silence is golden.
|
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Sitemap settings - post type tabs.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Sitemap
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$attributes = [];
|
||||
$post_type = $tab['post_type'];
|
||||
$prefix = "pt_{$post_type}_";
|
||||
|
||||
if ( 'attachment' === $post_type && Helper::get_settings( 'general.attachment_redirect_urls', true ) ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'attachment_redirect_urls_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>' ),
|
||||
]
|
||||
);
|
||||
$attributes['disabled'] = 'disabled';
|
||||
}
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => $prefix . 'sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include in Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include this post type in the XML sitemap.', 'rank-math' ),
|
||||
'default' => 'attachment' === $post_type ? 'off' : 'on',
|
||||
'attributes' => $attributes,
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => $prefix . 'html_sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include in HTML Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include this post type in the HTML sitemap if it\'s enabled.', 'rank-math' ),
|
||||
'default' => 'attachment' === $post_type ? 'off' : 'on',
|
||||
'attributes' => $attributes,
|
||||
'classes' => [
|
||||
'rank-math-html-sitemap',
|
||||
! Helper::get_settings( 'sitemap.html_sitemap' ) ? 'hidden' : '',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
if ( 'attachment' !== $post_type ) {
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => $prefix . 'image_customfields',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Image Custom Fields', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Insert custom field (post meta) names which contain image URLs to include them in the sitemaps. Add one per line.', 'rank-math' ),
|
||||
'dep' => [ [ $prefix . 'sitemap', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Sitemap settings - taxonomy tabs.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Sitemap
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$taxonomy = $tab['taxonomy'];
|
||||
$prefix = "tax_{$taxonomy}_";
|
||||
$is_enabled = 'category' === $taxonomy ? 'on' : 'off';
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => $prefix . 'sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include in Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include archive pages for terms of this taxonomy in the XML sitemap.', 'rank-math' ),
|
||||
'default' => $is_enabled,
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => $prefix . 'html_sitemap',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include in HTML Sitemap', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include archive pages for terms of this taxonomy in the HTML sitemap.', 'rank-math' ),
|
||||
'default' => $is_enabled,
|
||||
'classes' => [
|
||||
'rank-math-html-sitemap',
|
||||
! Helper::get_settings( 'sitemap.html_sitemap' ) ? 'hidden' : '',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => $prefix . 'include_empty',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Include Empty Terms', 'rank-math' ),
|
||||
'desc' => esc_html__( 'Include archive pages of terms that have no posts associated.', 'rank-math' ),
|
||||
'default' => 'off',
|
||||
'dep' => [ [ $prefix . 'sitemap', 'on' ] ],
|
||||
'classes' => 'rank-math-advanced-option',
|
||||
]
|
||||
);
|
Reference in New Issue
Block a user