Advertisement
vincurekf

Wordpress Customizer Setup Update

Aug 22nd, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action( 'customize_register', 'registerSection' );
  2.  
  3. function registerSection( $wp_customize ){
  4.  
  5.   $section_key = "custom_section_key";
  6.  
  7.   $wp_customize->add_section( $section_key, array(
  8.     'title'           => "Section Title",
  9.     'priority'        => 160,
  10.     'capability'      => 'manage_options',
  11.     'active_callback' => function () { return true; },
  12.   ) );
  13.  
  14.   $setting_id = "custom_setting_id";
  15.    
  16.   $wp_customize->add_setting( $setting_id, array(
  17.     'default'    => '',
  18.     'transport'  => 'refresh',
  19.     'capability' => 'manage_options',
  20.     'type'       => 'option',
  21.   ) );
  22.  
  23.   $wp_customize->add_control( $setting_id, array(
  24.     'label'    => 'Option Label',
  25.     'section'  => $section_key,
  26.     'setting'  => $setting_id,
  27.     'type'     => 'text',
  28.     'active_callback' => function () { return true; },
  29.   ) );
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement