esc_html__('Home', 'siteseo'), 'tab_siteseo_post_types' => esc_html__('Post types', 'siteseo'), 'tab_siteseo_archives' => esc_html__('Archives', 'siteseo'), 'tab_siteseo_taxonomies' => esc_html__('Taxonomies', 'siteseo'), 'tab_siteseo_advanced' => esc_html('Advanced','siteseo') ]; echo'
'; wp_nonce_field('sitseo_title_settings'); $titles_meta_toggle = isset($siteseo->setting_enabled['toggle-titles']) ? $siteseo->setting_enabled['toggle-titles'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); Dashbord::render_toggle('Titles & Metas - SiteSEO', 'titles_meta_toggle', $titles_meta_toggle, $nonce); echo'
'; self::home(); echo'
'; self::post_types(); echo'
'; self::archives(); echo'
'; self::taxonomies(); echo'
'; self::advanced(); echo'
'; siteseo_submit_button(__('Save changes', 'siteseo')); echo''; } static function home(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_titles_option_name'); //$options = $siteseo->titles_settings; $option_separator = isset($options['titles_sep']) ? $options['titles_sep'] : ''; $option_site_title = isset($options['titles_home_site_title']) ? $options['titles_home_site_title'] : ''; $option_site_title_alt = isset($options['titles_home_site_title_alt']) ? $options['titles_home_site_title_alt'] : ''; $option_site_desc = isset($options['titles_home_site_desc']) ? $options['titles_home_site_desc'] : ''; echo'

HOME

 

'.esc_html__('Title and meta description are used by search engines to generate the snippet of your site in search results page.', 'siteseo').'

'. esc_html('Customize your title & meta description for homepage','siteseo').'

'.esc_html__('Wrong meta title / description in SERP?', 'siteseo').'
Separator

'.esc_attr('Use this separator with %%sep%% in your title and meta description','siteseo').'

Site title
'; siteseo_suggestion_button(); echo'
Alternative site title

'.esc_html('The alternate name of the website (for example, if thers a commonly recognized acronym or shorter name for your site), if applicable. Make sure the name meets the', 'siteseo').'

Meta description
'; siteseo_suggestion_button(); echo'
'; } static function advanced(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->titles_settings; $options = get_option('siteseo_titles_option_name'); $option_noindex = isset($options['titles_noindex']) ? $options['titles_noindex'] : ''; $option_nofollow = isset($options['titles_nofollow']) ? $options['titles_nofollow'] : ''; $option_noimage = isset($options['titles_noimageindex']) ? $options['titles_noimageindex'] : ''; $option_noarchive = isset($options['titles_noarchive']) ? $options['titles_noarchive'] : ''; $option_nosnippet = isset($options['titles_nosnippet']) ? $options['titles_nosnippet'] : ''; $option_nositelinkssearchbox = isset($options['titles_nositelinkssearchbox']) ? $options['titles_nositelinkssearchbox'] : ''; $option_page_rel = isset($options['titles_paged_rel']) ? $options['titles_paged_rel'] : ''; $option_paged_noindex = isset($options['titles_paged_noindex']) ? $options['titles_paged_noindex'] : ''; $option_attachments_noindex = isset($options['titles_attachments_noindex']) ? $options['titles_attachments_noindex'] : ''; echo'

Advanced

Customize your metas for all pages.

noindex

'. esc_attr('Do not display all pages of the site in Google search results and do not display "Cached" links in search results.','siteseo').'

Check also the"Search engine visibility" setting from the WordPress Reading page

nofollow

'. esc_html('Do not follow links for all pages.','siteseo').'

noimageindex

'. esc_html('Do not follow links for all pages.','siteseo').'

noarchive

'.esc_html('Do not display a "Cached" link in the Google search results.','siteseo').'

nosnippet

'. esc_html('Do not display a description in the Google search results for all pages.','siteseo').'

nositelinkssearchbox

'. esc_html('Prevents Google to display a sitelinks searchbox in search results. Enable this option will remove the "Website" schema from your source code.','siteseo') .'

Indicate paginated content to Google

'.esc_html('eg: https://example.com/category/my-category/page/2/.','siteseo').'

noindex on paged archives

'.esc_html('eg: https://example.com/category/my-category/page/2/.','siteseo') .'

noindex on attachment pages

'. esc_html('eg: https://example.com/my-media-attachment-page.','siteseo').'

'; } static function archives(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // $options = $siteseo->titles_settings; $options = get_option('siteseo_titles_option_name'); // Load settings $option_author_title = $options['titles_archives_author_title'] ?? ''; $option_author_desc = $options['titles_archives_author_desc'] ?? ''; $option_author_noindex = $options['titles_archives_author_noindex'] ?? ''; $option_author_disabled = $options['titles_archives_author_disable'] ?? ''; $option_date_title = $options['titles_archives_date_title'] ?? ''; $option_date_desc = $options['titles_archives_date_desc'] ?? ''; $option_date_noindex = $options['titles_archives_date_noindex'] ?? ''; $option_date_disabled = $options['titles_archives_date_disable'] ?? ''; $option_search_title = $options['titles_archives_search_title'] ?? ''; $option_search_desc = $options['titles_archives_search_desc'] ?? ''; $option_search_noindex = $options['titles_archives_search_title_noindex'] ?? ''; $option_404_title = $options['titles_archives_404_title'] ?? ''; $option_404_desc = $options['titles_archives_404_desc'] ?? ''; $archives_fields = [ 'author-archives' => 'Author archives', 'date-archives' => 'Date archives', 'search-archives' => 'Search archives', '404-archives' => '404 archives' ]; echo'
'; $is_first = true; foreach($archives_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo'' . $post_val . ''; $is_first = false; } echo'

Archives

Customize your metas for all archives.

Author archives

Title template

'; siteseo_suggestion_button(); echo'

Meta description template


Date archives

Title template

'; siteseo_suggestion_button(); echo'

Meta description template


Search archives

Title template

'; siteseo_suggestion_button(); echo'

Meta description template


404 archives

Title template

'; siteseo_suggestion_button(); echo'

Meta description template


'; } static function post_types(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->titles_settings; $options = get_option('siteseo_titles_option_name'); // Load array $post_types = $options['titles_single_titles']['post'] ?? ''; $page_types = $options['titles_single_titles']['page'] ?? ''; // Load settings $option_post_enable = isset($post_types['enable']) ? $post_types['enable'] : 1; $option_post_title = isset($post_types['title']) ? $post_types['title'] : ''; $option_post_desc = isset($post_types['description']) ? $post_types['description'] : ''; $option_noindex = isset($post_types['noindex']) ? $post_types['noindex'] : ''; $option_nofollow = isset($post_types['nofollow']) ? $post_types['nofollow'] : ''; $option_date = isset($post_types['date']) ? $post_types['date'] : ''; $option_thumb_gcs = isset($post_types['thumb_gcs']) ? $post_types['thumb_gcs'] : ''; $option_page_enable = isset($page_types['enable']) ? $page_types['enable'] : 1; $option_page_title = isset($page_types['title']) ? $page_types['title'] : ''; $option_page_desc = isset($page_types['description']) ? $page_types['description'] : ''; $option_page_noindex = isset($page_types['noindex']) ? $page_types['noindex'] : ''; $option_page_nofollow = isset($page_types['nofollow']) ? $page_types['nofollow'] : ''; $option_page_date = isset($page_types['date']) ? $page_types['date'] : ''; $option_page_thumb = isset($page_types['thumb_gcs']) ? $page_types['thumb_gcs'] : ''; $post_types_fields = array( 'post-types' => 'Posts', 'pages-types' => 'Pages', ); echo'
'; $is_first = true; foreach($post_types_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo ''.$post_val.''; $is_first = false; } echo'

Post Types

Customize your titles & metas for Single Custom Post Types.

'; if(empty($option_post_title)){ echo'
 

'.wp_kses_post(__('Some Custom Post Types have no meta title set! We strongly encourage you to add one by filling in the fields below.', 'siteseo')).'

  1. '.esc_html__('post_tag', 'siteseo').'
'; } if(empty($option_page_desc)){ echo'
 

'.wp_kses_post(__('Some Custom Post Types have no meta description set! We strongly encourage you to add one by filling in the fields below..', 'siteseo')).'

  1. '.esc_html__('post_tag', 'siteseo').'
'; } echo'

Posts [post]

  

' . ($option_post_enable ? ' Click to hide any SEO metaboxes / columns for this post type' : ' Click to show any SEO metaboxes / columns for this post type') . '

Title template

'; siteseo_suggestion_button(); echo'

Meta description template

'; siteseo_suggestion_button(); echo'
'; if(!empty($option_noindex)){ echo'

'.wp_kses_post(__('This custom post type is NOT excluded from your XML sitemaps despite the fact that it is set to NOINDEX. ', 'siteseo')).'

'; } echo'

'. esc_html('Unchecking this does not prevent Google from displaying the post date in search results.','siteseo').'

'.esc_html('This option does not apply to traditional search results.','siteseo').'

Pages [pages]

  

' . ($option_page_enable ? ' Click to hide any SEO metaboxes / columns for this post type' : ' Click to show any SEO metaboxes / columns for this post type') . '

'.esc_html('Title template','siteseo').'

'; siteseo_suggestion_button(); echo'

'. esc_html('Meta description template','siteseo').'

'; siteseo_suggestion_button(); echo'
'; if(!empty($option_page_noindex)){ echo'

'.wp_kses_post(__('This custom post type is NOT excluded from your XML sitemaps despite the fact that it is set to NOINDEX. ', 'siteseo')).'

'; } echo'

'.esc_html('Unchecking this does not prevent Google from displaying the page date in search results.','siteseo').'

'.esc_html('This option does not apply to traditional search results.','siteseo').'

'; } static function taxonomies(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // $options = $siteseo->titles_setting; $options = get_option('siteseo_titles_option_name'); // Load array $options_cat = $options['titles_tax_titles']['category'] ?? ''; $option_tags = $options['titles_tax_titles']['post_tag'] ?? ''; // Load settings $option_enable_category = isset($options_cat['enable']) ? $options_cat['enable'] : ''; $option_cat_title = isset($options_cat['title']) ? $options_cat['title'] : ''; $option_cat_desc = isset($options_cat['description']) ? $options_cat['description'] : ''; $option_cat_noindex = isset($options_cat['noindex']) ? $options_cat['noindex'] : ''; $option_cat_nofollow = isset($options_cat['nofollow']) ? $options_cat['nofollow'] : ''; //tags $option_enable_tag = isset($option_tags['enable']) ? $option_tags['enable'] : ''; $option_tag_title = isset($option_tags['title']) ? $option_tags['title'] : ''; $option_tag_desc = isset($option_tags['description']) ? $option_tags['description'] : ''; $option_tag_noindex = isset($option_tags['noindex']) ? $option_tags['noindex'] : ''; $option_tag_nofollow = isset($option_tags['nofollow']) ? $option_tags['nofollow'] : ''; $taxonomies_fields = [ 'categories-types' => 'Categories', 'tags-types' => 'Tags', ]; echo'
'; $is_first = true; foreach($taxonomies_fields as $fields_key => $fields_val){ $active_class = $is_first ? 'active' : ''; echo''.$fields_val.''; $is_first = false; } echo'

Taxonomies

Customize your metas for all taxonomies archives.

'; if(empty($option_cat_title)){ echo'
 

'.wp_kses_post(__('Some Custom Taxonomies have no meta title set! We strongly encourage you to add one by filling in the fields below.', 'siteseo')).'

  1. '.esc_html__('post_tag', 'siteseo').'
'; } if(empty($option_tag_desc)){ echo'
 

'.wp_kses_post(__('Some Custom Taxonomies have no meta description set! We strongly encourage you to add one by filling in the fields below..', 'siteseo')).'

  1. '.esc_html__('post_tag', 'siteseo').'
'; } echo'

Categories [category]

' . ($option_enable_category ? 'Disable' : 'Enable') . '

Title template

'; siteseo_suggestion_button(); echo'

Meta description template

'; siteseo_suggestion_button(); echo'
'; if(!empty($option_cat_noindex)){ echo'

'.wp_kses_post(__('This custom taxonomy is NOT excluded from your XML sitemaps despite the fact that it is set to NOINDEX. We recommend that you check this out.', 'siteseo')).'

'; } echo'

Tags [post tag]

' . ($option_enable_tag ? 'Disable' : 'Enable') . '

Title template

'; siteseo_suggestion_button(); echo'

Meta description template

'; if(!empty($option_tag_noindex)){ echo'

'.wp_kses_post(__('This custom taxonomy is NOT excluded from your XML sitemaps despite the fact that it is set to NOINDEX. We recommend that you check this out.', 'siteseo')).'

'; } echo'

We do not recommend indexing tags which are, in the vast majority of cases, a source of duplicate content

'; } static function save_settings(){ global $siteseo; check_admin_referer('sitseo_title_settings'); if(!current_user_can('manage_options') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['home_tab'])){ $options['titles_sep'] = isset($_POST['siteseo_options']['separator']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['separator'])) : ''; $options['titles_home_site_title'] = isset($_POST['siteseo_options']['site_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['site_title'])) : ''; $options['titles_home_site_title_alt'] = isset($_POST['siteseo_options']['alt_site_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['alt_site_title'])) : ''; $options['titles_home_site_desc'] = isset($_POST['siteseo_options']['media_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['media_desc'])) : ''; } if(isset($_POST['siteseo_options']['advanced_tab'])){ $options['titles_noindex'] = isset($_POST['siteseo_options']['noindex']); $options['titles_nofollow'] = isset($_POST['siteseo_options']['no_follow']); $options['titles_noimageindex'] = isset($_POST['siteseo_options']['no_image']); $options['titles_noarchive'] = isset($_POST['siteseo_options']['no_archive']); $options['titles_nosnippet'] = isset($_POST['siteseo_options']['no_snippet']); $options['titles_nositelinkssearchbox'] = isset($_POST['siteseo_options']['no_site_links_searchbox']); $options['titles_paged_rel'] = isset($_POST['siteseo_options']['page_rel']); $options['titles_paged_noindex'] = isset($_POST['siteseo_options']['titles_paged_noindex']); $options['titles_attachments_noindex'] = isset($_POST['siteseo_options']['attachments_noindex']); } if(isset($_POST['siteseo_options']['post_types_tab'])){ $options['titles_single_titles']['post']['enable'] = isset($_POST['siteseo_options']['enable_post']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['enable_post'])) : ''; $options['titles_single_titles']['post']['title'] = isset($_POST['siteseo_options']['post_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['post_title'])) : ''; $options['titles_single_titles']['post']['description'] = isset($_POST['siteseo_options']['post_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['post_desc'])) : ''; $options['titles_single_titles']['post']['noindex'] = isset($_POST['siteseo_options']['post_noindex']); $options['titles_single_titles']['post']['nofollow'] = isset($_POST['siteseo_options']['post_nofollow']); $options['titles_single_titles']['post']['date'] = isset($_POST['siteseo_options']['post_date']); $options['titles_single_titles']['post']['thumb_gcs'] = isset($_POST['siteseo_options']['thumb_gcs']); $options['titles_single_titles']['page']['enable'] = isset($_POST['siteseo_options']['page_enable']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['page_enable'])) : ''; $options['titles_single_titles']['page']['title'] = isset($_POST['siteseo_options']['page_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['page_title'])) : ''; $options['titles_single_titles']['page']['description'] = isset($_POST['siteseo_options']['page_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['page_desc'])) : ''; $options['titles_single_titles']['page']['noindex'] = isset($_POST['siteseo_options']['page_noindex']); $options['titles_single_titles']['page']['nofollow'] = isset($_POST['siteseo_options']['page_nofollow']); $options['titles_single_titles']['page']['date'] = isset($_POST['siteseo_options']['page_date']); $options['titles_single_titles']['page']['thumb_gcs'] = isset($_POST['siteseo_options']['page_gcs']); } if(isset($_POST['siteseo_options']['archives_tab'])){ $options['titles_archives_author_title'] = isset($_POST['siteseo_options']['author_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['author_title'])) : ''; $options['titles_archives_author_desc'] = isset($_POST['siteseo_options']['author_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['author_desc'])) : ''; $options['titles_archives_author_noindex'] = isset($_POST['siteseo_options']['author_noindex']); $options['titles_archives_author_disable'] = isset($_POST['siteseo_options']['author_disable']); $options['titles_archives_date_title'] = isset($_POST['siteseo_options']['date_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['date_title'])) : ''; $options['titles_archives_date_desc'] = isset($_POST['siteseo_options']['date_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['date_desc'])) : ''; $options['titles_archives_date_noindex'] = isset($_POST['siteseo_options']['date_noindex']); $options['titles_archives_date_disable'] = isset($_POST['siteseo_options']['date_disable']); $options['titles_archives_search_title'] = isset($_POST['siteseo_options']['search_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['search_title'])) : ''; $options['titles_archives_search_desc'] = isset($_POST['siteseo_options']['search_desc']) ? sanitize_text_field(wp_unslash( $_POST['siteseo_options']['search_desc'])) : ''; $options['titles_archives_search_title_noindex'] = isset($_POST['siteseo_options']['search_noindex']); $options['titles_archives_404_title'] = isset($_POST['siteseo_options']['title_404']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['title_404'])) : ''; $options['titles_archives_404_desc'] = isset($_POST['siteseo_options']['desc_404']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['desc_404'])) : ''; } if(isset($_POST['siteseo_options']['taxonomies_tab'])){ $options['titles_tax_titles']['category']['enable'] = isset($_POST['siteseo_options']['enable_category']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['enable_category'])) : ''; $options['titles_tax_titles']['category']['title'] = isset($_POST['siteseo_options']['category_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['category_title'])) : ''; $options['titles_tax_titles']['category']['description'] = isset($_POST['siteseo_options']['category_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['category_desc'])) : ''; $options['titles_tax_titles']['category']['noindex'] = isset($_POST['siteseo_options']['category_noindex']); $options['titles_tax_titles']['category']['nofollow'] = isset($_POST['siteseo_options']['category_nofollow']); $options['titles_tax_titles']['post_tag']['enable'] = isset($_POST['siteseo_options']['post_tag_enable']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['post_tag_enable'])) : ''; $options['titles_tax_titles']['post_tag']['title'] = isset($_POST['siteseo_options']['tags_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['tags_title'])) : ''; $options['titles_tax_titles']['post_tag']['description'] = isset($_POST['siteseo_options']['tags_description']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['tags_description'])) : ''; $options['titles_tax_titles']['post_tag']['noindex'] = isset($_POST['siteseo_options']['tags_noindex']); $options['titles_tax_titles']['post_tag']['nofollow'] = isset($_POST['siteseo_options']['tags_nofollow']); } // $options = $siteseo->titles_settings; update_option('siteseo_titles_option_name', $options); } }