wp-customize-colors.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. class GlobalStylesColorCustomizer {
  3. private $section_key = 'customize-global-styles-colors';
  4. function __construct() {
  5. add_action( 'customize_register', array( $this, 'initialize' ) );
  6. }
  7. function initialize( $wp_customize ) {
  8. $theme = wp_get_theme();
  9. $wp_customize->add_section(
  10. $this->section_key,
  11. array(
  12. 'capability' => 'edit_theme_options',
  13. 'description' => sprintf( __( 'Color Customization for %1$s', 'blockbase' ), $theme->name ),
  14. 'title' => __( 'Colors', 'blockbase' ),
  15. )
  16. );
  17. $wp_customize->add_control(
  18. $this->section_key . '-migration-notice',
  19. array(
  20. 'type' => 'hidden',
  21. 'description' => '<div class="notice notice-info">
  22. <p>' . __( 'Color customization for this theme is now available exclusively in the Full Site Editor Global Styles panel.<br><br>Featured Palettes can now be found in the Full Site Editor as Theme Variations.', 'blockbase' ) . '</p>
  23. </div>',
  24. 'settings' => array(),
  25. 'section' => $this->section_key,
  26. )
  27. );
  28. $wp_customize->add_control(
  29. $this->section_key . '-site-editor-button',
  30. array(
  31. 'type' => 'hidden',
  32. 'description' => sprintf( '<a class="button button-primary" href=%s style="font-style: normal;" >Use Site Editor</a>', esc_url( admin_url( 'site-editor.php?styles=open' ) ) ),
  33. 'settings' => array(),
  34. 'section' => $this->section_key,
  35. )
  36. );
  37. }
  38. }
  39. new GlobalStylesColorCustomizer;