リンク内容
上記リンク先のシドニーというテーマで
リンク内容
上記リンク先のパースというテーマのPerth FP:のウィジェットが使用したくて
パースのウィジェットフォルダから
・ fp-sep-type-a.php
・ fp-sep-type-b.php
をコピーし、シドニーのウィジェットフォルダに格納し、functions.phpに読み込む用に追記しました。
それは成功して、上記の二つのウィジェットは使用出来たのですが、左右反転バージョンのウィジェットも使用したくコピーしたものを
・ fp-sep-type-c.php
・ fp-sep-type-d.php
と名前を変えて格納、
functions.phpに追記し、エラーもなかったので読み込んでいるのだと思いますが、ウィジェット選択画面で表示されません。表示されているのはtype-a、type-bのみです。
どうすれば表示されるようになるのか教えて頂きたく存じます。
例として
・ fp-sep-type-a.php
html
1<?php 2 3class Perth_Separator_Type_A extends WP_Widget { 4 5 function perth_separator_type_a() { 6 $widget_ops = array('classname' => 'perth_sep_a', 'description' => __( 'Row separator', 'perth') ); 7 parent::__construct(false, $name = __('Perth FP: Separator Type A', 'perth'), $widget_ops); 8 $this->alt_option_name = 'perth_sep_a'; 9 10 } 11 12 function form($instance) { 13 $sep_fill = isset( $instance['sep_fill'] ) ? esc_html( $instance['sep_fill'] ) : ''; 14 ?> 15 16 <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> 17 18 <p><label for="<?php echo $this->get_field_id('sep_fill'); ?>"><?php _e('Fill color for the separator', 'perth'); ?></label></p> 19 <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> 20 21 <?php 22 } 23 24 function update($new_instance, $old_instance) { 25 $instance = $old_instance; 26 $instance['sep_fill'] = strip_tags($new_instance['sep_fill']); 27 28 $alloptions = wp_cache_get( 'alloptions', 'options' ); 29 if ( isset($alloptions['perth_action']) ) 30 delete_option('perth_action'); 31 32 return $instance; 33 } 34 35 function widget($args, $instance) { 36 $cache = array(); 37 if ( ! $this->is_preview() ) { 38 $cache = wp_cache_get( 'perth_action', 'widget' ); 39 } 40 41 if ( ! is_array( $cache ) ) { 42 $cache = array(); 43 } 44 45 if ( ! isset( $args['widget_id'] ) ) { 46 $args['widget_id'] = $this->id; 47 } 48 49 if ( isset( $cache[ $args['widget_id'] ] ) ) { 50 echo $cache[ $args['widget_id'] ]; 51 return; 52 } 53 54 ob_start(); 55 extract($args); 56 57 $sep_fill = isset( $instance['sep_fill'] ) ? esc_html($instance['sep_fill']) : ''; 58 ?> 59 60 <div class="svg-container row-svg row-separator" style="fill:<?php echo $sep_fill; ?>"> 61 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100" preserveAspectRatio="none"> 62 <path d="M0 0 L100 0 L100 2 L0 30 Z"></path> 63 </svg> 64 </div> 65 66 67 <?php 68 if ( ! $this->is_preview() ) { 69 $cache[ $args['widget_id'] ] = ob_get_flush(); 70 wp_cache_set( 'perth_action', $cache, 'widget' ); 71 } else { 72 ob_end_flush(); 73 } 74 } 75 76}
のAの部分をCに変更して格納、Bの部分をD二変更して格納してます。
あなたの回答
tips
プレビュー