プラグインを直接編集した場合アップデートで上書きしたら機能しなくなるので止めた方が良いです。
以下をテーマのfunctions.phpに追記してみてください。
if ( function_exists( 'commentimage_comment_form' ) ) {
remove_action( 'comment_form', 'commentimage_comment_form', 99 );
function my_commentimage_comment_form() {
?>
<script type="text/javascript">
jQuery(function($){
$('#file_input').change(function() {
$('#dummy_file').val($(this).val());
});
})
</script>
<div class="form-group" style="width:250px"><div class="input-group">
<input type="file" id="file_input" name="image" style="display: none;">
<span class="input-group-btn"><button class="btn btn-default" type="button" onclick="jQuery('#file_input').click();">
<i class="glyphicon glyphicon-folder-open"></i></button></span>
<div class="input-group"><input id="dummy_file" type="text" class="form-control" placeholder="select file..." disabled></div></div></div>
<?php
}
add_action( 'comment_form', 'my_commentimage_comment_form' );
}
上手くいったんでしょうか?
解決したなら解決済にしてください。
(@nanopass)
7年、 6ヶ月前
Comment Imageのfile formデザインを変更しようと下記のようにしたのですが上手くいかず困っています。
plugin.php(119行目)
echo '<p style="clear: both"><input style="width: auto" type="file" name="image' . ($i==0?'':$i) . '"/> ' . htmlspecialchars($options['label']) . '</p>';
上記を下記に変更
comments.php内の<?php comment_form(); ?>下あたりに下記を追加
希望通り表示はできているのですがクリックしても反応しません。
どのように修正すれば良いのかアドバイスをお願い致します。