setting_enabled['toggle-xml-sitemap']) ? $siteseo->setting_enabled['toggle-xml-sitemap'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_sitemap_general'; // Default tab $titles_meta_subtabs = [ 'tab_sitemap_general' => esc_html__('Home', 'siteseo'), 'tab_sitemap_post_types' => esc_html__('Post types', 'siteseo'), 'tab_sitemap_taxonomy ' => esc_html__('Taxonomy', 'siteseo'), 'tab_sitmap_html' => esc_html__('HTML Sitemap', 'siteseo') ]; echo'
'; wp_nonce_field('siteseo_sitemap_settings'); Dashbord::render_toggle('Sitemaps - SiteSEO', 'sitemap_toggle', $sitemap_toggle, $nonce); echo'
'; self::general_sitemaps(); echo'
'; self::post_types_sitemaps(); echo'
'; self::taxonomy_sitemap(); echo'
'; self::html_sitemap(); echo'
'; siteseo_submit_button(__('Save changes', 'siteseo')); echo ''; } static function general_sitemaps(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_xml_sitemap_option_name'); $xml_sitemap = isset($options['xml_sitemap_general_enable']) ? $options['xml_sitemap_general_enable'] : ''; $img_sitemap = isset($options['xml_sitemap_img_enable']) ? $options['xml_sitemap_img_enable'] : ''; $author_sitemap = isset($options['xml_sitemap_author_enable']) ? $options['xml_sitemap_author_enable'] : ''; $html_sitemap = isset($options['xml_sitemap_html_enable']) ? $options['xml_sitemap_html_enable'] : ''; echo'

'.esc_html('General','siteseo').'

A sitemap is a file where you provide information about the pages, images, videos... and the relationships between them. Search engines like Google read this file to crawl your site more efficiently.

The XML sitemap is an exploration aid. Not having a sitemap will absolutely NOT prevent engines from indexing your content. For this, opt for meta robots.

'.esc_attr('This is the URL of your index sitemaps to submit to search engines:','siteseo').'

To view your sitemap, enable permalinks (not default one), and save settings to flush them.

Enable XML Sitemap
Enable Image Sitemap

'.esc_html('Images in XML sitemaps are visible only from the source code.','siteseo').'

Enable Author Sitemap

'.esc_html('Make sure to enable author archive from SEO, titles and metas, archives tab.','siteseo').'

Enable HTML Sitemap
'; } static function post_types_sitemaps(){ if(!empty($_POST['submit'])){ self::save_settings(); } echo'

Post Types

Include/Exclude Post Types.

'.esc_html('Check to INCLUDE Post Types','siteseo').'
'; } static function taxonomy_sitemap(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $get_taxonomies = get_taxonomies(); $check_taxomies = apply_filters('siteseo_sitemaps_tax', $get_taxonomies); echo'

Taxonomies

Taxonomies

Check to INCLUDE Taxonomies '; foreach($check_taxomies as $taxonomies_key =>$taxonomies_value){ echo'

'; } echo'
'; } static function html_sitemap(){ if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_xml_sitemap_option_name'); $include_pages = isset($options['xml_sitemap_html_mapping']) ? $options['xml_sitemap_html_mapping'] : ''; $exclude_page = isset($options['xml_sitemap_html_exclude']) ? $options['xml_sitemap_html_exclude'] : ''; $oder = isset($options['xml_sitemap_html_order']) ? $options['xml_sitemap_html_order'] : ''; $order_by = isset($options['xml_sitemap_html_orderby']) ? $options['xml_sitemap_html_orderby'] : ''; $disable_date = isset($options['xml_sitemap_html_date']) ? $options['xml_sitemap_html_date'] : ''; $remove_archive = isset($options['xml_sitemap_html_archive_links']) ? $options['xml_sitemap_html_archive_links'] : ''; echo'

'.esc_html('HTML Sitemap','siteseo').'

'.esc_html('Create an HTML Sitemap for your visitors and boost your SEO.','siteseo').'

'.esc_html('Limited to 1,000 posts per post type. You can change the order and sorting criteria below.','siteseo').'

' . esc_html__('How to use the HTML Sitemap?', 'siteseo') . '

' . esc_html__('Block Editor', 'siteseo') . '

' . wp_kses_post(__('Add the HTML sitemap block using the Block Editor.', 'siteseo')) . '

' . esc_html__('Shortcode', 'siteseo') . '

' . esc_html__('You can also use this shortcode in your content (post, page, post type...):', 'siteseo') . '

[siteseo_html_sitemap]

' . esc_html__('To include specific custom post types, use the CPT attribute:', 'siteseo') . '

[siteseo_html_sitemap cpt="post,product"]

' . esc_html__('Other', 'siteseo') . '

' . esc_html__('Dynamically display the sitemap by entering an ID to the first field below.', 'siteseo') . '

Post, Page, or Custom Post Type IDs to display:
Exclude Posts, Pages, Custom Post Types or Terms IDs:
Order:
Order By:
Disable Date:
Remove Archive Links:
'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_sitemap_settings'); if(!current_user_can('manage_options') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['general_sitemaps'])){ $options['xml_sitemap_general_enable'] = isset($_POST['siteseo_options']['enable_xml_sitemap']); $options['xml_sitemap_img_enable'] = isset($_POST['siteseo_options']['enable_img_sitemap']); $options['xml_sitemap_author_enable'] = isset($_POST['siteseo_options']['enable_author_sitemap']); $options['xml_sitemap_html_enable'] = isset($_POST['siteseo_options']['enable_html_sitemap']); } if(isset($_POST['siteseo_options']['html_sitemap'])){ $options['xml_sitemap_html_mapping'] = isset($_POST['siteseo_options']['page_numbers']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['page_numbers'])) : ''; $options['xml_sitemap_html_exclude'] = isset($_POST['siteseo_options']['exclude_page']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['exclude_page'])) : ''; $options['xml_sitemap_html_order'] = isset($_POST['siteseo_options']['order'])? sanitize_text_field(wp_unslash($_POST['siteseo_options']['order'])) : ''; $options['xml_sitemap_html_orderby'] = isset($_POST['siteseo_options']['order_by']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['order_by'])) : ''; $options['xml_sitemap_html_date'] = isset($_POST['siteseo_options']['disable_date']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['disable_date'])) : ''; $options['xml_sitemap_html_archive_links'] = isset($_POST['siteseo_options']['remove_links']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['remove_links'])) : ''; } // posts if(isset($_POST['siteseo_options']['xml_sitemap_post_types_list'])){ foreach($_POST['siteseo_options']['xml_sitemap_post_types_list'] as $posttypes_key => $posttypes_value){ if(isset($posttypes_value['include'])){ $options['xml_sitemap_post_types_list'][$posttypes_key]['include'] = sanitize_text_field(wp_unslash($posttypes_value['include'])); } } } // Taxonomies if(isset($_POST['siteseo_options']['xml_sitemap_taxonomies_list'])){ foreach($_POST['siteseo_options']['xml_sitemap_taxonomies_list'] as $taxonomy_key => $taxonomy_value){ if(isset($taxonomy_value['include'])){ $options['xml_sitemap_taxonomies_list'][$taxonomy_key]['include'] = sanitize_text_field(wp_unslash($taxonomy_value['include'])); } } } update_option('siteseo_xml_sitemap_option_name',$options); } }