Alright so I've been creating a theme for WordPress and now I want to add my own custom control in the WordPress theme customization panel, I know how to create the control, I currently have the following:
class Example_Customize_Checkbox_Control extends WP_Customize_Control {
public $type = 'multiple-select';
public function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<ul>
<?php
// help around here?
// list choices but as checkboxes
echo '<li><input type="checkbox"></label></li>';
?>
</ul>
<input type="hidden" id="<?php echo $this->id; ?>" class="cstmzr-hidden-categories" <?php $this->link(); ?> value="<?php echo sanitize_text_field( $this->value() ); ?>">
</label>
<?php
}
}
and the choices would be something like this:
'choices' => array(
'item1' => 'item1',
'item2' => 'item2',
'item3' => 'item3',
)
I would like it to work just how the option boxes work but instead being checkboxes, the reason I need to create it like this is because there will be images next to the checkboxes to select which ones to use.
Not sure on how to do this with WordPress, can't seem to find anything on the subject.
Any help would be great, thanks.
Aucun commentaire:
Enregistrer un commentaire