Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. class Sample_Radio_Image_Control extends WP_Customize_Control {
  2.  
  3. public $type = 'radio-image';
  4.  
  5. public function render_content() {
  6.  
  7. if ( empty( $this->choices ) )
  8. return;
  9.  
  10. $name = '_customize-radio-' . $this->id;
  11.  
  12. ?>
  13. <style>
  14. input.stylish-radio-image {
  15. display: none;
  16. }
  17. input.stylish-radio-image + span {
  18. margin-right: 10px;
  19. display: inline-flex;
  20. padding: 2px!important;
  21. width: auto;
  22. height: auto;
  23. overflow: hidden;
  24. border: 2px solid #FFFFFF;
  25. }
  26. input.stylish-radio-image:checked + span {
  27. border: 2px solid #777777;
  28. }
  29. </style>
  30. <label>
  31. <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
  32. <?php foreach ( $this->choices as $value => $label ) : ?>
  33. <label>
  34. <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 ); ?>"/>
  35. <span><img src="<?php echo esc_url($label); ?>" alt="<?php echo esc_attr( $value ); ?>" /></span>
  36. </label>
  37. <?php endforeach; ?>
  38. </label>
  39. <?php
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement