WP+WCの2回目。
でもよく考えると、WooCommerceもWCだね^^;
最初にやることは、
ここらへんでいきなり質問!ではなくて、まず調べて解析なんですが、
当然のようにJUSTな検索なんかあるわけでもなく、
ここらへんを読むと、結果的に、『自分で解析しましょう!』ってなってます。
ということで、どうするかというと、

これを見ると(※テーマ:Riffles)、まずは"オプションを指定してください"というのを検索してみればよいようなきがするので、やってみます。
そうすると、こんなんが引っかかります。
plugins/usc-e-shop/languages/usces-ja.po(2442): msgstr "オプションを指定してください。"
plugins/usc-e-shop/languages/usces-th.po(2199): msgstr "オプションを指定してください。"
plugins/usc-e-shop/languages/usces.pot(2256): msgstr "オプションを指定してください。"
で、これは言語設定ファイルなので、開いてみると、
msgid "Please appoint an option."
msgstr "オプションを指定してください。"
って感じ。
よって、"Please appoint an option."をGREP。
とりあえずこれだけ発見。
wp-content/plugins/usc-e-shop/templates/single_item.php(45): $html .= "/n";
wp-content/plugins/usc-e-shop/templates/single_item.php(102): $html .= "
" . apply_filters('usces_filter_single_item_options_caption', __('Please appoint an option.', 'usces'), $post) . "
/n";
wp-content/plugins/usc-e-shop/theme/welcart_default/wc_templates/wc_item_single.php(51):
wp-content/plugins/usc-e-shop/theme/welcart_default/wc_templates/wc_item_single.php(108):
wp-content/themes/riffles_ver1.1/wc_templates/wc_item_single.php(169):
wp-content/themes/riffles_ver1.1/wc_templates/wc_item_single.php(288):
wp-content/themes/welcart_default/wc_templates/wc_item_single.php(51):
wp-content/themes/welcart_default/wc_templates/wc_item_single.php(108):
wp-content/themes/welcart_default_kid/wc_templates/wc_item_single.php(51):
wp-content/themes/welcart_default_kid/wc_templates/wc_item_single.php(108):
" . apply_filters('usces_filter_single_item_options_caption', __('Please appoint an option.', 'usces'), $post) . "
ということで、single_item.php(45):を調べてみます。ってやってみてハマってしまいました。
まぁCODEをたいして理解しないでやってるのが問題なのですが、これを追っていくと、
if (usces_is_options()) {
$html .= "\n";
while (usces_have_options()) {
$opttr = "";
$html .= apply_filters('usces_filter_singleitem_option', $opttr, usces_getItemOptName(), NULL) . "\n";
}
$html .= "
" . apply_filters('usces_filter_single_item_options_caption', __('Please appoint an option.', 'usces'), $post) . "
" . esc_html(usces_getItemOptName()) . ' | ' . usces_the_itemOption(usces_getItemOptName(),'','return') . " |
\n";
}
こんなものを発見するのです。問題はコレ。
apply_filters('usces_filter_singleitem_option'
これをフックすれば何か楽しいことになりそうなきがするじゃないですか、よって、プラグインを書いて検証です。
プラグインは以下。
<?php
/*
Plugin Name: Wlecart keiskes Custom Plugin
Author: keiske
■
*/
/*
st-wc-custom.php
*/
//---------------------------------------
add_filter('usces_filter_singleitem_option','st_usces_filter_singleitem_option');
//---------------------------------------
function st_usces_filter_singleitem_option($opttr="", $name="", $alt=""){
deBug($opttr);
return $opttr;
}
//---------------------------------------
function deBug($v,$fl="/web/st-wc-cuatom-php.html"){
$f = fopen($fl, "a");
fwrite($f, $v."\n");
fclose($f);
}
//---------------------------------------
?>
でやっていると、、そもそも、これ、呼ばれて無い!!!(LOG、書かれず。^^;)
つづく。