Home  >  Article  >  CMS Tutorial  >  How to add contact information in wordpress

How to add contact information in wordpress

藏色散人
藏色散人Original
2019-07-19 10:27:287093browse

How to add contact information in wordpress

How to add contact information in wordpress

In the WordPress backend, in the personal settings (Profile), in addition to setting the email In addition to email and website, you can also set up your own contact information, such as AIM, Yahoo IM, Jabber/Google Talk. But except for Gtalk, the other two are basically not used by Chinese people. So how do we remove AIM and Yahoo IM, which we basically don’t use, and add QQ, MSN and Fetion, which are commonly used by Chinese people?

In fact, it is very easy to implement such a function in WordPress. You only need to call the custom_contactmethods WordPress Filter to support commonly used contact methods such as QQ, MSN and Fetion in the background. The code is as follows:

<?php
/*
Plugin Name: Custom Contact
Plugin URI: http://wpjam.com/
Description: 自定义博客的联系方式,从 WordPress 默认的 AIM, Yahoo IM 改为中国常见的 QQ, MSN 和飞信。
Version: 1.0
Author: Neekey
Author URI: http://photozero.net/
*/
add_filter(&#39;user_contactmethods&#39;,&#39;custom_contactmethods&#39;);
function custom_contactmethods($user_contactmethods ){
    $user_contactmethods  = array(
        &#39;qq&#39; => &#39;QQ&#39;,
        &#39;msn&#39; => &#39;MSN&#39;,
        &#39;jabber&#39; => __(&#39;Jabber / Google Talk&#39;),
        &#39;fetion&#39; => &#39;飞信&#39;
    );
    return $user_contactmethods ;
}
?>

Save the above code as a PHP file in UTF-8 without BOM format, upload it to the WordPress plug-in directory, and then activate it. If you need to add other contact information, you only need to add it in the above array in the same way. I will not introduce them in detail here.

Before using the plug-in:

How to add contact information in wordpress

The effect after using the plug-in:

How to add contact information in wordpress

This function is in a It is particularly useful in multi-user managed blogs. We will apply this function in the next project, please stay tuned.

For more WordPress technical articles, please visit the WordPress Tutorial column!

The above is the detailed content of How to add contact information in wordpress. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn