Skip to content

Instantly share code, notes, and snippets.

@redroot
Created February 20, 2013 17:06
Show Gist options
  • Select an option

  • Save redroot/4997131 to your computer and use it in GitHub Desktop.

Select an option

Save redroot/4997131 to your computer and use it in GitHub Desktop.
Example Wordpress Customiser Category Dropdown Control
<?php
class WP_Customize_Category_Control extends WP_Customize_Control {
public $type = 'dropdown-category';
public function render_content() {
$dropdown = wp_dropdown_categories(array(
"selected" => $this->value(),
"name" => $this->settings["default"]->id,
"echo" => 0
));
$dropdown = str_replace( '<select', '<select '.$this->get_link(), $dropdown);
?>
<label>
<p class="customize-control-title"><?php echo esc_html($this->label);?></p>
<div><?php echo $dropdown; ?>
</div>
</label>
<?php
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment