Make WordPress Core

Ticket #28979: settings-customizer.php

File settings-customizer.php, 2.4 KB (added by celloexpressions, 8 years ago)

"Settings Customizer" plugin shell that adds a Settings panel with several sections to the Customizer, for testing purposes.

Line 
1<?php
2/**
3 * Plugin Name: Settings Customizer
4 * Plugin Author: celloexpressions
5 * Description: Adds all of WordPress' core settings to a panel in the Customizer. Currently just adds panel & sections.
6 * Version: 0.0
7 */
8
9// Enqueue scripts
10
11// Register all settings and controls.
12add_action( 'customize_register', 'settings_customizer_register' );
13function settings_customizer_register( $wp_customize ) {
14        // Register settings in the Customizer.
15       
16       
17        // Add the Settings panel.
18        $wp_customize->add_panel( 'settings', array(
19                'title' => __( 'Settings' ),
20                'description' => __( 'All of these settings are also found in the WordPress adminstration interface, under the "Settings" menu.' ),
21                'priority' => 200,
22        ) );
23
24        // Add sections to organize the controls.
25        $wp_customize->add_section( 'administration', array(
26                'title'    => __( 'Administration' ),
27                'panel'    => 'settings',
28                'priority' => 5,// admin email, convert emotions, correct xhtml nesting, default post category, default post format, (default link category)
29        ) );
30        $wp_customize->add_section( 'datetime', array(
31                'title'    => __( 'Date and Time' ), // Locale instead?
32                'panel'    => 'settings',
33                'priority' => 10,// language, timezone, date format, time format, (week starts on, if not removed)
34        ) );
35        $wp_customize->add_section( 'media', array(
36                'title'    => __( 'Media' ),
37                'panel'    => 'settings',
38                'priority' => 15,// image sizes thumbnail, medium, large, crop or proportional thumbnails
39        ) );
40        $wp_customize->add_section( 'discussion', array(
41                'title'    => __( 'Discussion' ),
42                'panel'    => 'settings',
43                'priority' => 20,// give this a major overhaul
44        ) );
45        $wp_customize->add_section( 'under_hood', array(
46                'title'    => __( 'Under the Hood' ),
47                'description' => __( 'These settings should only be changed once, when you first set up your site. Use caution when changing them later.' ),
48                'panel'    => 'settings',
49                'priority' => 25, // search engine visibility, permalinks,
50        ) );
51       
52        // uncategorized settings: blog pages show X posts, feeds,
53       
54        // @todo these are placeholders for mockup purposes.
55        $sections = array( 'administration', 'datetime', 'discussion', 'media', 'under_hood' );
56        foreach ( $sections as $section ) {
57                $wp_customize->add_setting( $section, array( 'default' => '', 'type' => 'option' ) );
58                $wp_customize->add_control( $section, array( 'type' => 'text', 'label' => ucfirst($section), 'section' => $section ) );
59        }
60}
61
62
63
64
65