Skip to content

Instantly share code, notes, and snippets.

@jessengatai
Last active April 5, 2017 00:35
Show Gist options
  • Save jessengatai/90c0ffd458a5da983ba9f2cffd66b668 to your computer and use it in GitHub Desktop.
Save jessengatai/90c0ffd458a5da983ba9f2cffd66b668 to your computer and use it in GitHub Desktop.
/**
* Add a new section class that allows for adding sectional titles to the customizer
* @param class $wp_customize Instance of WP_Customize_Manager created when using the 'customize_register' hook
*/
add_action( 'customize_register', 'jn_section_titles_class' );
function jn_section_titles_class($wp_customize) {
/**
* Extends the WP_Customize_Section for custom output
* @return void
*/
class JN_Customizer_Section_Title extends WP_Customize_Section {
/**
* Render the sectional title in the customiser
* @access public
* @return void
*/
public function render() {
$id = $this->id;
$title = $this->title;
$description = $this->description;
?>
<li id="accordion-section-<?php echo $id; ?>" class="accordion-sectional-title" style="">
<?php if($title) { ?>
<h3 class="sectional-title" tabindex="-1">
<?php echo $title; ?>
</h3>
<?php } ?>
<?php if( $description!='' ) { ?>
<span class="description sectional-title-description"><?php echo $description; ?></span>
<?php } ?>
</li>
<?php
} // end render
} // end extend class
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment