質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

Q&A

0回答

1270閲覧

ウィジェットがウィジェット選択画面で表示されない。

sato.tanaka

総合スコア8

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

0グッド

0クリップ

投稿2017/11/21 06:05

編集2017/11/21 06:10

リンク内容
上記リンク先のシドニーというテーマで

リンク内容
上記リンク先のパースというテーマの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二変更して格納してます。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2017/12/04 12:25

変更したソースコード(functions.php、fp-sep-type-c.php、fp-sep-type-d.php)を記載されたほうが回答がつきやすくなるのではないでしょうか。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問