Creating a heading option with a description:
*
$adminPage->createOption( array(
* 'name' => __( 'General Settings', 'default' ),
* 'type' => 'heading',
* 'desc' => __( 'Settings for the general usage of the plugin', 'default' ),
* ) );
*
* @since 1.0
* @type heading
* @availability Admin Pages|Meta Boxes|Customizer
* @no id,default,livepreview,css,hidden
*/
class TitanFrameworkOptionHeading extends TitanFrameworkOption {
/**
* Display for options and meta
*/
public function display() {
$headingID = str_replace( ' ', '-', strtolower( $this->settings['name'] ) );
?>
settings['name'] ?>
settings['desc'] ) ) {
?>settings['desc'] ?>
|
add_control( new TitanFrameworkOptionHeadingControl( $wp_customize, $this->getID(), array(
'label' => $this->settings['name'],
'section' => $section->settings['id'],
'type' => 'select',
'settings' => $this->getID(),
'description' => $this->settings['desc'],
'priority' => $priority,
) ) );
}
}
// We create a new control for the theme customizer.
add_action( 'customize_register', 'register_titan_framework_option_heading_control', 1 );
/**
* Register the customizer control
*/
function register_titan_framework_option_heading_control() {
/**
* Heading option class
*
* @since 1.0
*/
class TitanFrameworkOptionHeadingControl extends WP_Customize_Control {
/**
* The description of this control
*
* @var bool
*/
public $description;
/**
* Renders the control
*/
public function render_content() {
?>
label ) ?>
description ) ) {
echo "
" . wp_kses_post( $this->description ) . '
';
}
?>