taxonomy-content.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Views\Taxonomies
  6. *
  7. * @uses Yoast_Form $yform Form object.
  8. * @uses WP_Taxonomy $wpseo_taxonomy
  9. * @uses Yoast_View_Utils $view_utils
  10. * @uses string $title
  11. * @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
  12. * @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
  13. */
  14. if ( $wpseo_taxonomy->name === 'post_format' ) {
  15. $yform->light_switch(
  16. 'disable-post_format',
  17. __( 'Format-based archives', 'wordpress-seo' ),
  18. [ __( 'Enabled', 'wordpress-seo' ), __( 'Disabled', 'wordpress-seo' ) ],
  19. false
  20. );
  21. }
  22. echo "<div id='" . esc_attr( $wpseo_taxonomy->name ) . "-titles-metas'>";
  23. $taxonomies_help = $view_utils->search_results_setting_help( $wpseo_taxonomy );
  24. $yform->index_switch(
  25. 'noindex-tax-' . $wpseo_taxonomy->name,
  26. $title,
  27. $taxonomies_help->get_button_html() . $taxonomies_help->get_panel_html()
  28. );
  29. // Determine the page type for the term, this is needed for the recommended replacement variables.
  30. $page_type = $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name );
  31. $editor = new WPSEO_Replacevar_Editor(
  32. $yform,
  33. [
  34. 'title' => 'title-tax-' . $wpseo_taxonomy->name,
  35. 'description' => 'metadesc-tax-' . $wpseo_taxonomy->name,
  36. 'page_type_recommended' => $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
  37. 'page_type_specific' => $editor_specific_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
  38. 'paper_style' => false,
  39. ]
  40. );
  41. $editor->render();
  42. if ( $wpseo_taxonomy->name !== 'post_format' ) {
  43. /* translators: %1$s expands to Yoast SEO */
  44. $yform->show_hide_switch( 'display-metabox-tax-' . $wpseo_taxonomy->name, sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' ) );
  45. }
  46. /**
  47. * Allow adding custom checkboxes to the admin meta page - Taxonomies tab.
  48. *
  49. * @api WPSEO_Admin_Pages $yform The WPSEO_Admin_Pages object
  50. * @api Object $tax The taxonomy
  51. */
  52. do_action( 'wpseo_admin_page_meta_taxonomies', $yform, $wpseo_taxonomy );
  53. echo '</div>';