taxonomy-content.php 2.1 KB

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