質問編集履歴

2

追記しました。

2017/11/21 06:10

投稿

sato.tanaka
sato.tanaka

スコア8

test CHANGED
File without changes
test CHANGED
@@ -204,4 +204,4 @@
204
204
 
205
205
  ```
206
206
 
207
- のAの部分をcに変更して格納
207
+ のAの部分をCに変更して格納、Bの部分をD二変更して格納してます。

1

追記

2017/11/21 06:10

投稿

sato.tanaka
sato.tanaka

スコア8

test CHANGED
File without changes
test CHANGED
@@ -41,3 +41,167 @@
41
41
 
42
42
 
43
43
  どうすれば表示されるようになるのか教えて頂きたく存じます。
44
+
45
+
46
+
47
+ 例として
48
+
49
+ ・ fp-sep-type-a.php
50
+
51
+ ```html
52
+
53
+ <?php
54
+
55
+
56
+
57
+ class Perth_Separator_Type_A extends WP_Widget {
58
+
59
+
60
+
61
+ function perth_separator_type_a() {
62
+
63
+ $widget_ops = array('classname' => 'perth_sep_a', 'description' => __( 'Row separator', 'perth') );
64
+
65
+ parent::__construct(false, $name = __('Perth FP: Separator Type A', 'perth'), $widget_ops);
66
+
67
+ $this->alt_option_name = 'perth_sep_a';
68
+
69
+
70
+
71
+ }
72
+
73
+
74
+
75
+ function form($instance) {
76
+
77
+ $sep_fill = isset( $instance['sep_fill'] ) ? esc_html( $instance['sep_fill'] ) : '';
78
+
79
+ ?>
80
+
81
+
82
+
83
+ <p><em><?php _e('This is a slanted row separator. It blends with the row directly <strong>below</strong> it. Add the color from the row <strong>above</strong> it to achieve the slanted effect. ', 'perth'); ?></em></p>
84
+
85
+
86
+
87
+ <p><label for="<?php echo $this->get_field_id('sep_fill'); ?>"><?php _e('Fill color for the separator', 'perth'); ?></label></p>
88
+
89
+ <p><input class="widefat" id="<?php echo $this->get_field_id('sep_fill'); ?>" name="<?php echo $this->get_field_name('sep_fill'); ?>" type="text" value="<?php echo $sep_fill; ?>" /></p>
90
+
91
+
92
+
93
+ <?php
94
+
95
+ }
96
+
97
+
98
+
99
+ function update($new_instance, $old_instance) {
100
+
101
+ $instance = $old_instance;
102
+
103
+ $instance['sep_fill'] = strip_tags($new_instance['sep_fill']);
104
+
105
+
106
+
107
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
108
+
109
+ if ( isset($alloptions['perth_action']) )
110
+
111
+ delete_option('perth_action');
112
+
113
+
114
+
115
+ return $instance;
116
+
117
+ }
118
+
119
+
120
+
121
+ function widget($args, $instance) {
122
+
123
+ $cache = array();
124
+
125
+ if ( ! $this->is_preview() ) {
126
+
127
+ $cache = wp_cache_get( 'perth_action', 'widget' );
128
+
129
+ }
130
+
131
+
132
+
133
+ if ( ! is_array( $cache ) ) {
134
+
135
+ $cache = array();
136
+
137
+ }
138
+
139
+
140
+
141
+ if ( ! isset( $args['widget_id'] ) ) {
142
+
143
+ $args['widget_id'] = $this->id;
144
+
145
+ }
146
+
147
+
148
+
149
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
150
+
151
+ echo $cache[ $args['widget_id'] ];
152
+
153
+ return;
154
+
155
+ }
156
+
157
+
158
+
159
+ ob_start();
160
+
161
+ extract($args);
162
+
163
+
164
+
165
+ $sep_fill = isset( $instance['sep_fill'] ) ? esc_html($instance['sep_fill']) : '';
166
+
167
+ ?>
168
+
169
+
170
+
171
+ <div class="svg-container row-svg row-separator" style="fill:<?php echo $sep_fill; ?>">
172
+
173
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100" preserveAspectRatio="none">
174
+
175
+ <path d="M0 0 L100 0 L100 2 L0 30 Z"></path>
176
+
177
+ </svg>
178
+
179
+ </div>
180
+
181
+
182
+
183
+
184
+
185
+ <?php
186
+
187
+ if ( ! $this->is_preview() ) {
188
+
189
+ $cache[ $args['widget_id'] ] = ob_get_flush();
190
+
191
+ wp_cache_set( 'perth_action', $cache, 'widget' );
192
+
193
+ } else {
194
+
195
+ ob_end_flush();
196
+
197
+ }
198
+
199
+ }
200
+
201
+
202
+
203
+ }
204
+
205
+ ```
206
+
207
+ のAの部分をcに変更して格納