Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Sample_Radio_Image_Control extends WP_Customize_Control {
- public $type = 'radio-image';
- public function render_content() {
- if ( empty( $this->choices ) )
- return;
- $name = '_customize-radio-' . $this->id;
- ?>
- <style>
- input.stylish-radio-image {
- display: none;
- }
- input.stylish-radio-image + span {
- margin-right: 10px;
- display: inline-flex;
- padding: 2px!important;
- width: auto;
- height: auto;
- overflow: hidden;
- border: 2px solid #FFFFFF;
- }
- input.stylish-radio-image:checked + span {
- border: 2px solid #777777;
- }
- </style>
- <label>
- <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
- <?php foreach ( $this->choices as $value => $label ) : ?>
- <label>
- <input type="radio" value="<?php echo esc_attr( $value ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> class="stylish-radio-image" name="<?php echo esc_attr( $name ); ?>"/>
- <span><img src="<?php echo esc_url($label); ?>" alt="<?php echo esc_attr( $value ); ?>" /></span>
- </label>
- <?php endforeach; ?>
- </label>
- <?php
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement