rearrange some things
This commit is contained in:
parent
0ffac972f6
commit
9c93d00ff6
|
@ -80,53 +80,52 @@ class ComicPressBookmarkWidget extends WP_Widget {
|
||||||
name="<?php echo $this->get_field_name('title') ?>"
|
name="<?php echo $this->get_field_name('title') ?>"
|
||||||
value="<?php echo esc_attr($instance['title']) ?>" />
|
value="<?php echo esc_attr($instance['title']) ?>" />
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
foreach (array(
|
foreach (array(
|
||||||
'three-button' => __('Three-button mode', 'comicpress'),
|
'three-button' => __('Three-button mode', 'comicpress'),
|
||||||
'one-button' => __('One-button mode', 'comicpress')
|
'one-button' => __('One-button mode', 'comicpress')
|
||||||
) as $mode => $label) { ?>
|
) as $mode => $label) { ?>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
id="<?php echo $this->get_field_id($mode) ?>"
|
id="<?php echo $this->get_field_id($mode) ?>"
|
||||||
name="<?php echo $this->get_field_name('mode') ?>"
|
name="<?php echo $this->get_field_name('mode') ?>"
|
||||||
value="<?php echo esc_attr($mode) ?>"
|
value="<?php echo esc_attr($mode) ?>"
|
||||||
<?php echo $instance['mode'] == $mode ? 'checked="checked"' : '' ?> /> <?php echo $label ?>
|
<?php echo $instance['mode'] == $mode ? 'checked="checked"' : '' ?> /> <?php echo $label ?>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<div id="<?php echo $this->get_field_id("${mode}-options") ?>"><p>
|
<div id="<?php echo $this->get_field_id("${mode}-options") ?>"><p>
|
||||||
<?php
|
<?php
|
||||||
foreach ($this->text_fields[$mode] as $name => $info) {
|
foreach ($this->text_fields[$mode] as $name => $info) {
|
||||||
extract($info);
|
extract($info);
|
||||||
$value = empty($instance[$name]) ? $default : $instance[$name];
|
$value = empty($instance[$name]) ? $default : $instance[$name];
|
||||||
?>
|
?>
|
||||||
<label><?php echo $label ?><br />
|
<label><?php echo $label ?><br />
|
||||||
<input class="widefat" type="text"
|
<input class="widefat" type="text"
|
||||||
name="<?php echo $this->get_field_name($name) ?>"
|
name="<?php echo $this->get_field_name($name) ?>"
|
||||||
value="<?php echo esc_attr($value) ?>" />
|
value="<?php echo esc_attr($value) ?>" />
|
||||||
</label>
|
</label>
|
||||||
<br /><?php
|
<br /><?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</p></div>
|
</p></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function($) {
|
||||||
|
var wrapper = '<?php echo $this->get_field_id('wrapper') ?>';
|
||||||
|
var radios = $('#' + wrapper + ' input[type=radio]');
|
||||||
|
|
||||||
|
var show = function() {
|
||||||
|
radios.each(function() {
|
||||||
|
$('#' + this.id + '-options')[this.checked ? 'show' : 'hide']();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
radios.click(show);
|
||||||
|
show();
|
||||||
|
}(jQuery));
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
(function($) {
|
|
||||||
var wrapper = '<?php echo $this->get_field_id('wrapper') ?>';
|
|
||||||
var radios = $('#' + wrapper + ' input[type=radio]');
|
|
||||||
|
|
||||||
var show = function() {
|
|
||||||
radios.each(function() {
|
|
||||||
$('#' + this.id + '-options')[this.checked ? 'show' : 'hide']();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
radios.click(show);
|
|
||||||
show();
|
|
||||||
}(jQuery));
|
|
||||||
</script>
|
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
function update($new_instance, $old_instance) {
|
function update($new_instance, $old_instance) {
|
||||||
|
|
Loading…
Reference in New Issue