よくある回答
フィルターフックuser_contactmethodsにunset()使えば削除できるよ!
function foo( $bar ) { unset($bar['aim']); }
add_filter('user_contactmethods','foo',10,1);
そうだね。こんな感じで削除できるね。
aim, jabbar, yimだけなら……な(facebookやtwitterも多分いける)。
でも、ネットでよく転がってる上記の方式だと、例えば配色とか、姓名の入力欄とか、
そんな項目が削除できないんだよね……。
今回提示する解決策の要綱
functions.phpのアクションフックにjQueryとCSS3のセレクタを使用し、
該当箇所をdisplay:none;で潰して行きます。
だったらCSS3を読みこませるだけでいいんじゃね?
IE8以下がCSS3を扱えないので……。
selectivizr.jsが使えれば良かったんですが、wordpressと相性が悪いみたいで。
例示の前に、wordpressでjQueryを扱うコツ
jQueryの記法、$(...)は、wordpressではjQuery(...)と記述すること。
今まで知らなかったんだ……。だってJavascript苦手なんだもん……。
WordPressでjQueryを使うときに、問題なく動作させる為の基礎知識やTipsと、動かない場合の対処例
http://kachibito.net/web-design/wordpress-with-jquery.html
実際の例
/* プロフィール欄の不要項目を、jQueryで削除 */
function profile_js() {
?>
<!-- wordpress3.1.4以下なら、下記が必要。使用中のjQuery1.7以上なら以下がなくても動く -->
<!--[if lt IE 9]>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<![endif]-->
<script type="text/javascript">
tftn = "table.form-table:nth-of-type";
jQuery(document).ready(function() {
jQuery("div#profile-page h3").css("display", "none");
jQuery(tftn + "(1)").css("display", "none");
jQuery(tftn + "(2) tr:nth-child(2)").css("display", "none");
jQuery(tftn + "(2) tr:nth-child(3)").css("display", "none");
jQuery(tftn + "(2) tr:nth-child(4)").css("display", "none");
jQuery(tftn + "(2) tr:nth-child(5)").css("display", "none");
jQuery(tftn + "(3) tr:nth-child(2)").css("display", "none");
jQuery(tftn + "(4) tr:nth-child(1)").css("display", "none");
});
</script>
<?php }
//アクションフックshow_user_profileにこのスクリプトを組み込む
add_action( 'show_user_profile', 'profile_js' );