date-archives-settings.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Views\Archive
  6. *
  7. * @var Yoast_Form $yform
  8. * @var WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
  9. * @var WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
  10. */
  11. $yform->toggle_switch(
  12. 'disable-date',
  13. array(
  14. 'off' => __( 'Enabled', 'wordpress-seo' ),
  15. 'on' => __( 'Disabled', 'wordpress-seo' ),
  16. ),
  17. __( 'Date archives', 'wordpress-seo' )
  18. );
  19. ?>
  20. <div id='date-archives-titles-metas-content' class='archives-titles-metas-content'>
  21. <?php
  22. $date_archives_help = new WPSEO_Admin_Help_Panel(
  23. 'noindex-archive-wpseo',
  24. esc_html__( 'Help on the date archives search results setting', 'wordpress-seo' ),
  25. sprintf(
  26. /* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
  27. esc_html__( 'Not showing the date archives in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
  28. '<code>noindex</code>',
  29. '<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
  30. '</a>'
  31. )
  32. );
  33. $yform->index_switch(
  34. 'noindex-archive-wpseo',
  35. __( 'date archives', 'wordpress-seo' ),
  36. $date_archives_help->get_button_html() . $date_archives_help->get_panel_html()
  37. );
  38. $recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
  39. $editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
  40. $editor = new WPSEO_Replacevar_Editor(
  41. $yform,
  42. array(
  43. 'title' => 'title-archive-wpseo',
  44. 'description' => 'metadesc-archive-wpseo',
  45. 'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'date' ),
  46. 'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( 'date' ),
  47. 'paper_style' => false,
  48. )
  49. );
  50. $editor->render();
  51. ?>
  52. </div>