https://github.com/pattonwebz/customizer-info-control
A simple control for outputting small informational blocks in the customizer.
https://github.com/pattonwebz/customizer-info-control
customizer customizer-control wordpress wordpress-customizer
Last synced: about 1 year ago
JSON representation
A simple control for outputting small informational blocks in the customizer.
- Host: GitHub
- URL: https://github.com/pattonwebz/customizer-info-control
- Owner: pattonwebz
- License: gpl-2.0
- Created: 2019-02-28T21:20:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T18:13:24.000Z (about 7 years ago)
- Last Synced: 2025-02-10T12:21:17.131Z (about 1 year ago)
- Topics: customizer, customizer-control, wordpress, wordpress-customizer
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
README
# PattonWebz Customizer Info Control
A simple control for using when you want to output a small informational section within the customizer.
## Using the class
The control works just like any other custom class control in that you register a setting for it and the control and place it inside a section.
The class looks at 2 specific keys that you pass into the args array when registering the control. The `title` key and the `html` key.
The passed in value for `title` is wrapped inside an `
` tag and the `html` is wrapped inside of a `
` tag at output time.
```
// The control must go in a defined section.
$wp_customize->add_section(
'a_section',
array(
'title' => __( 'A Section', 'pattonwebz' ),
)
);
// It should also have a setting defined with a custom setting 'type'.
// This can be any unique string you want - you won't be attaching custom actions to it.
$wp_customize->add_setting(
'an_info_control',
array(
'type' => 'display_only',
)
);
// Add the control with it's title and html content.
$wp_customize->add_control(
new \PattonWebz\Customizer\Control\InfoControl(
$wp_customize,
'an_info_control',
array(
'section' => 'a_section',
'title' => __( 'Custom Info Control', 'pattonwebz' ),
'html' => __( 'This control has ability to output a title and custom html content.', 'pattonwebz' ),
)
)
);
```
You can optionally override the wrappers added by passing in an `'override_wrapper' => 'true'` argument. This will output just raw `html` so you need to include your own wrappers and any title you may want directly in the html string.
# Licence Information
This package is licensed under GNU GPLv2 or later licence.
Copyright 2019 © William Patton.