Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

84 Zeilen
1.8 KiB

  1. <?php
  2. /**
  3. * Customize API: WP_Customize_Nav_Menu_Location_Control class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Customize Menu Location Control Class.
  11. *
  12. * This custom control is only needed for JS.
  13. *
  14. * @since 4.3.0
  15. *
  16. * @see WP_Customize_Control
  17. */
  18. class WP_Customize_Nav_Menu_Location_Control extends WP_Customize_Control {
  19. /**
  20. * Control type.
  21. *
  22. * @since 4.3.0
  23. * @access public
  24. * @var string
  25. */
  26. public $type = 'nav_menu_location';
  27. /**
  28. * Location ID.
  29. *
  30. * @since 4.3.0
  31. * @access public
  32. * @var string
  33. */
  34. public $location_id = '';
  35. /**
  36. * Refresh the parameters passed to JavaScript via JSON.
  37. *
  38. * @since 4.3.0
  39. * @access public
  40. *
  41. * @see WP_Customize_Control::to_json()
  42. */
  43. public function to_json() {
  44. parent::to_json();
  45. $this->json['locationId'] = $this->location_id;
  46. }
  47. /**
  48. * Render content just like a normal select control.
  49. *
  50. * @since 4.3.0
  51. * @access public
  52. */
  53. public function render_content() {
  54. if ( empty( $this->choices ) ) {
  55. return;
  56. }
  57. ?>
  58. <label>
  59. <?php if ( ! empty( $this->label ) ) : ?>
  60. <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
  61. <?php endif; ?>
  62. <?php if ( ! empty( $this->description ) ) : ?>
  63. <span class="description customize-control-description"><?php echo $this->description; ?></span>
  64. <?php endif; ?>
  65. <select <?php $this->link(); ?>>
  66. <?php
  67. foreach ( $this->choices as $value => $label ) :
  68. echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';
  69. endforeach;
  70. ?>
  71. </select>
  72. </label>
  73. <button type="button" class="button-link edit-menu<?php if ( ! $this->value() ) { echo ' hidden'; } ?>" aria-label="<?php esc_attr_e( 'Edit selected menu' ); ?>"><?php _e( 'Edit Menu' ); ?></button>
  74. <?php
  75. }
  76. }