○表記を日本語化したい。
(「wp-contactform.php」で該当の箇所を修正すると日本語で表示することができるらしいのですが、どこを直すのやら・・・)
○レイアウトがズレているのを直したい。
この2点でアドバイスを下さる方、教えて下さい!!
ちなみに、下記が「contactform.css」です。
/*Original style*/
#contactform {
width:800px;
height:500px;
margin:5px 0px;
overflow: hidden;
}
#contactform legend {
text-align:left;
font-weight:bold;
}
#contactform br {
display:none;
}
label.contactleft {
padding: 6px;
margin: 2px 0;
width:20%;
float:left;
text-align:right;
clear:both;
}
.contactright {
width:70%;
padding: 4px;
margin: 2px 0;
float:right;
}
.contacterror {
border: 1px solid #ff0000;
}
#contactsubmit {
width:30%;
text-align:left;
padding:4px;
display:block;
}
よろしくお願い致します!
>表記を日本語化したい。
これについては、「wp-contact-form-iii/wp-contactform.php」を下記のように書き換えます。
日本語になっている部分があるので分かると思います。このままコピペしてもいいです。
それから、プラグインは「wp-content/plugins/wp-contact-form」にアップロードして下さい。
アップロードした後に必ず管理画面から「オプション」→「Contact Form III」にアクセスして初期設定を行なって下さい。
これを行なうことで多分レイアウトのズレは直ると思います。
<?php /* Plugin Name: WP Contact Form III Plugin URI: http://kzkw.net/wp/ Description: WP Contact Form III is a simple drop in form for users to contact you. It can be implemented on a page or a post. Go to Options -> ContactForm III to configure. Challenge (antispam) mod by <a href="http://www.douglaskarr.com">Doug Karr</a>. Original script by <a href="http://ryanduff.net">Ryan Duff</a> Author: Kristin K. Wangen Author URI: http://kzkw.net/ Version: 1.4 */ /* Copyleft 2007 Kristin K. Wangen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ if(function_exists('load_betterlang_textdomain')) { load_betterlang_textdomain('cfiii'); } else { load_plugin_textdomain('cfiii', $path = 'wp-content/plugins/wp-contact-form/languages'); } /* Declare strings that change depending on input. This also resets them so errors clear on resubmission. */ $wpcf_strings = array('name' => '<input class="contactright" type="text" name="wpcf_your_name" id="wpcf_your_name" size="30" maxlength="50" value="' . $_POST['wpcf_your_name'] . '" />','email' => '<input class="contactright" type="text" name="wpcf_email" id="wpcf_email" size="30" maxlength="50" value="' . $_POST['wpcf_email'] . '" />','subject' => '<input class="contactright" type="text" name="wpcf_subject" id="wpcf_subject" size="30" maxlength="50" value="' .$_POST['wpcf_subject'] . '" />','response' => '<input class="contactright" type="text" name="wpcf_response" id="wpcf_response" size="30" maxlength="50" value="' . $_POST['wpcf_response'] . '" />','msg' => '<textarea class="contactright" name="wpcf_msg" id="wpcf_msg" cols="35" rows="8" >' . $_POST['wpcf_msg'] . '</textarea>','error' => '',); /* This shows the quicktag on the write pages Based off Buttonsnap Template http://redalt.com/downloads */ if(get_option('wpcf_show_quicktag') == true) { include('buttonsnap.php'); add_action('init', 'wpcf_button_init'); add_action('marker_css', 'wpcf_marker_css'); function wpcf_button_init() { $wpcf_button_url = buttonsnap_dirname(__FILE__) . '/wpcf_button.png'; buttonsnap_textbutton($wpcf_button_url, __('Contact Form', 'cfiii'), '[contactform]'); buttonsnap_register_marker('contact form', 'wpcf_marker'); } function wpcf_marker_css() { $wpcf_marker_url = buttonsnap_dirname(__FILE__) . '/wpcf_marker.gif'; echo " .wpcf_marker { display: block; height: 15px; width: 155px margin-top: 5px; background-image: url({$wpcf_marker_url}); background-repeat: no-repeat; background-position: center; } "; } } function wpcf_is_malicious($input) { $is_malicious = false; $bad_inputs = array("\r", "\n", "mime-version", "content-type", "bcc:", "cc:", "to:"); foreach($bad_inputs as $bad_input) { if(strpos(strtolower($input), strtolower($bad_input)) !== false) { $is_malicious = true; break; } } return $is_malicious; } function wpcf_is_challenge($input) { $is_challenge = false; $answer = get_option('wpcf_answer'); $answer = stripslashes(trim($answer)); if($input == $answer) { $is_challenge = true; } return $is_challenge; } /* This function checks for errors on input and changes $wpcf_strings if there are any errors. Shortcircuits if there has not been a submission */ function wpcf_check_input() { if(!(isset($_POST['wpcf_stage']))) {return false;} // Shortcircuit. $_POST['wpcf_your_name'] = stripslashes(trim($_POST['wpcf_your_name'])); $_POST['wpcf_email'] = stripslashes(trim($_POST['wpcf_email'])); $_POST['wpcf_response'] = stripslashes(trim($_POST['wpcf_response'])); $_POST['wpcf_website'] = stripslashes(trim($_POST['wpcf_website'])); $_POST['wpcf_subject'] = stripslashes(trim($_POST['wpcf_subject'])); $_POST['wpcf_msg'] = stripslashes(trim($_POST['wpcf_msg'])); global $wpcf_strings; $ok = true; if(empty($_POST['wpcf_your_name'])) { $ok = false; $reason = 'empty'; $wpcf_strings['name'] = '<input type="text" name="wpcf_your_name" id="wpcf_your_name" size="30" maxlength="50" value="' . $_POST['wpcf_your_name'] . ' (' . __('required', 'cfiii') . ')" class="contacterror contactright" />' ; } if(!is_email($_POST['wpcf_email'])) { $ok = false; $reason = 'empty'; $wpcf_strings['email'] = '<input type="text" name="wpcf_email" id="wpcf_email" size="30" maxlength="50" value="' . $_POST['wpcf_email'] . ' (' . __('required', 'cfiii') . ')" class="contacterror contactright" />'; } if(empty($_POST['wpcf_response'])) { $ok = false; $reason = 'empty'; $wpcf_strings['response'] = '<input type="text" name="wpcf_response" id="wpcf_response" size="30" maxlength="50" value="' . $_POST['wpcf_response'] . ' (' . __('required', 'cfiii') . ')" class="contacterror contactright" />'; } if (!wpcf_is_challenge($_POST['wpcf_response'])) { $ok = false; $reason = 'wrong'; $wpcf_strings['response'] = '<input type="text" name="wpcf_response" id="wpcf_response" size="30" maxlength="50" value="' . $_POST['wpcf_response'] . ' (' . __('required', 'cfiii') . ')" class="contacterror contactright" />'; } if(empty($_POST['wpcf_subject'])) { $ok = false; $reason = 'empty'; $wpcf_strings['subject'] = '<input type="text" name="wpcf_subject" id="wpcf_subject" size="30" maxlength="50" value="' . $_POST['wpcf_subject'] . ' (' . __('required', 'cfiii') . ')" class="contacterror contactright" />'; } if(empty($_POST['wpcf_msg'])) { $ok = false; $reason = 'empty'; $wpcf_strings['msg'] = '<textarea name="wpcf_msg" id="wpcf_message" cols="35" rows="8" class="contacterror contactright">' . $_POST['wpcf_msg'] . ' (' . __('required', 'cfiii') . ')</textarea>'; } if(wpcf_is_malicious($_POST['wpcf_your_name']) || wpcf_is_malicious($_POST['wpcf_email'])) { $ok = false; $reason = 'malicious'; } if($ok == true) { return true; } else { if($reason == 'malicious') { $wpcf_strings['error'] = "<em>".__('You can not use any of the following in the Name or Email fields: a linebreak, or the phrases \'mime-version\', \'content-type\', \'cc:\' \'bcc:\'or \'to:\'.','cfiii')."</em>"; } elseif($reason == 'empty') { $wpcf_strings['error'] = '<em>' . stripslashes(get_option('wpcf_error_msg')) . '</em>'; } elseif($reason == 'wrong') { $wpcf_strings['error'] = "<em>".__('You answered the challenge question incorrectly.', 'cfiii')."</em>"; } return false; } } /*Wrapper function which calls the form.*/ function wpcf_callback( $content ) { global $wpcf_strings; wpautop($content, 0); /* Run the input check. */ if(! preg_match('|[contactform]|', $content)) { return $content; } if(wpcf_check_input()) // If the input check returns true (ie. there has been a submission & input is ok) { $recipient = get_option('wpcf_email'); $subject = $_POST['wpcf_subject']; $success_msg = get_option('wpcf_success_msg'); $success_msg = stripslashes($success_msg); $name = $_POST['wpcf_your_name']; $email = $_POST['wpcf_email']; $website = $_POST['wpcf_website']; $msg = $_POST['wpcf_msg']; $headers = "MIME-Version: 1.0\n"; $headers .= "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; $fullmsg = "$name ".__('wrote:','cfiii')."\n"; $fullmsg .= wordwrap($msg, 80, "\n") . "\n\n"; $fullmsg .= "".__('Website:','cfiii')." " . $website . "\n"; $fullmsg .= "".__('IP:','cfiii')."" . getip(); mail($recipient, $subject, $fullmsg, $headers); $results = '<strong>' . $success_msg . '</strong>'; echo $results; } else // Else show the form. If there are errors the strings will have updated during running the inputcheck. { $question = stripslashes(get_option('wpcf_question')); $form = trim('<form id="contactform" action="' . get_permalink() . '" method="post"> <fieldset><legend> '.__('Contact Form','cfiii').'</legend><div><em>* '.__('必須事項','cfiii').'</em>' . $wpcf_strings['error'] . '</div> <label class="contactleft" for="wpcf_your_name">' . __('名前: ', 'cfiii') . '*</label>' . $wpcf_strings['name'] . ' <label class="contactleft" for="wpcf_email">' . __('メールアドレス:', 'cfiii') . '*</label>' . $wpcf_strings['email'] . ' <label class="contactleft" for="wpcf_website">' . __('ホームページ:', 'cfiii') . '</label> <input class="contactright" type="text" name="wpcf_website" id="wpcf_website" size="30" maxlength="100" value="' . $_POST['wpcf_website'] . '" /> <label class="contactleft" for="wpcf_subject">' . __('題名:', 'cfiii') . '*</label>' . $wpcf_strings['subject'] . ' <label class="contactleft" for="wpcf_msg">' . __('本文: ', 'cfiii') . '*</label>' . $wpcf_strings['msg'] . ' <label class="contactleft" for="wpcf_response">' . __($question, 'cfiii') . '*</label>' . $wpcf_strings['response'] . ' <input class="contactright" type="submit" name="Submit" value="' . __('送信', 'cfiii') . '" id="contactsubmit" /> <input type="hidden" name="wpcf_stage" value="process" /> </fieldset></form>'); return str_replace('[contactform]', $form, $content); } } /*Can't use WP's function here, so lets use our own*/ function getip() { if (isset($_SERVER)) { if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { $ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (isset($_SERVER["HTTP_CLIENT_IP"])) { $ip_addr = $_SERVER["HTTP_CLIENT_IP"]; } else { $ip_addr = $_SERVER["REMOTE_ADDR"]; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) { $ip_addr = getenv( 'HTTP_CLIENT_IP' ); } else { $ip_addr = getenv( 'REMOTE_ADDR' ); } } return $ip_addr; } /*CSS Styling*/ function wpcf_css() { ?> <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('wpurl'); ?>/wp-content/plugins/wp-contact-form/contactform.css" /> <?php } function wpcf_add_options_page() { add_options_page('Contact Form Options', 'Contact Form III', 'manage_options', 'wp-contact-form/options-contactform.php'); } /* Action calls for all functions */ //if(get_option('wpcf_show_quicktag') == true) {add_action('admin_footer', 'wpcf_add_quicktag');} add_action('admin_head', 'wpcf_add_options_page'); add_filter('wp_head', 'wpcf_css'); add_filter('the_content', 'wpcf_callback', 7); ?>
>これは、wp-content/plugins/wp-contact-formという名前に変えればよい、ということでしょうか?
その通りです。
プラグイン自身がフォルダ名を決め打ちしているのでそれ以外の名前だと設定画面に入れませんし、そのフォルダに入っているcssファイルにもアクセスできずにレイアウトが乱れるのです。
以降、もし必要があればコメント欄を開けてもらえればそちらの方でフォローします。
フォルダ名を変えましたら、設定画面に入ることが出来ました!!
しかし、レイアウトは崩れたままですTT
コメントOPENにしましたので、
お時間のある時で結構ですので、お助け下さいませ!
wordpress難しい。。。
回答者 | 回答 | 受取 | ベストアンサー | 回答時間 | |
---|---|---|---|---|---|
1 | hamster078 | 587回 | 476回 | 4回 | 2007-10-26 01:06:35 |
ありがとうございます!!
日本語化の方は、一度文字化けしましたが、
何とか出来ました!!
それから、
>>プラグインは「wp-content/plugins/wp-contact-form」にアップロード
とありますが、「wp-content/plugins/wp-contact-form-iii」とは違う、ということですか?
確かに、各種設定からContactformⅢを選択すると、404になってしまうのですが^^;
これは、wp-content/plugins/wp-contact-formという名前に変えればよい、ということでしょうか?