修改WordPress里用户页的联系信息(Contact Info)

新旧界面对比,旧界面中的 aim,jabber,yim 被去掉了,加入了时下大家最熟悉的 facebook,twitter …… add_filter( ‘user_contactmethods’ , ‘update_contact_methods’ , 10 , 1 ); function update_contact_methods( $contactmethods ) { // Add new fields $contactmethods[‘phone’] = ‘Phone’; $contactmethods[‘mobile’] = ‘Mobile’; $contactmethods[‘address’] …

WPML Coding API and Custom Language Switcher

老是打不开这些页面,干脆复制到自己的地盘来了。方便自己也方便大家。 神马?WPML 是啥,自己百度吧! WPML offers functions that can be used in your WordPress theme to provide correct support for multilingual themes. Function Purpose Notes do_action(‘icl_language_selector’) Insert the drop down language …

WordPress debug code

WordPress debug 代码,把它放在function 文件里,就会在每页的页脚出现这个,包括当前模板,重写规则,Query 等等。 add_action( ‘template_include’, ‘_childtheme_print_template_name’ ); function _childtheme_print_template_name( $template_name ) { global $childtheme_template_name; $childtheme_template_name = $template_name; add_action( ‘wp_footer’, ‘childtheme_print_template_name’, 100 ); return $template_name; } function childtheme_print_template_name( ) …

Contact Form 7 的那些事儿

Customization of Contact Form 7 plugin Additional headers:You can input any header lines into the field and you can insert any tags into any place in each header line, just …

php数组随机排序

$array = array(‘A’,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’10’,’J’,’Q’,’K’); shuffle($array); //随机排序数组 print_r($array); //输出数组

WordPress Portfolio work with Isotope and Infinite Scroll

准备:需要的jQuery插件 Isotope: 神奇的布局精致的jQuery插件。演示 Infinite Scroll:无限滚动被称为autopagerize的,unpaginate,无尽的网页。但实质上,它是预取从随后出现的页面上的内容,并直接将其添加到用户的当前页面。http://www.infinite-scroll.com/ 演示 新建文章类型 portfolio 和 Portfolio 分类  function my_post_types() { register_post_type(‘portfolio’, array( ‘label’ => __(‘Portfolio’,’itc’), ‘singular_label’ => __(‘Portfolio’, ‘itc’), ‘_builtin’ => false, //’exclude_from_search’ => false, // Exclude from Search …

Get Featured Image with timthumb

$w = ‘350’; $h = ‘200’; if (has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘full’); echo ”; } else { echo ”; }

Linux基本命令

arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 – (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT /dev/sda 在磁盘上执行测试性读取操作 cat /proc/cpuinfo 显示CPU info的信息 cat /proc/interrupts 显示中断 …

php 法语字母排序

if($langcode == ‘fr’){ setlocale(LC_COLLATE, ‘fr_CA.utf8’); } ksort($array,SORT_LOCALE_STRING); 法语字幕有声调,往往在默认排序上会有些问题。上面的代码可以解决法语字母排序错误的问题。 同样可以应用于 sort asort 等等

Create wordpress custom widget

代码放到 functions.php 就可以在小工具里获得该 widget。 class weibo_widget extends WP_Widget { public function __construct() { // widget actual processes //get_popular_resource parent::__construct( ‘weibo_widget’, // Base ID ‘Weibo widget’, // Name array(‘description’ => __(‘Weibo …

Media, Audio, Video Player for wordpress

function yyy_html5_audio($url) { if (preg_match(‘/Firefox/’, $_SERVER[“HTTP_USER_AGENT”])) { // For religious reasons Firefox does not support MP3 format in HTML5 audio tag, use Flash player instead $embed = ”; } else …

LINUX CP 命令详解

cp (复制档案或目录) [root@linux ~]# cp [-adfilprsu] 来源档(source) 目的檔(destination) [root@linux ~]# cp [options] source1 source2 source3 …. directory 参数: -a :相当于 -pdr 的意思; -d :若来源文件为连结文件的属性(link file),则复制连结文件属性而非档案本身; -f :为强制 (force) 的意思,若有重复或其它疑问时,不会询问使用者,而强制复制; -i …

Simple jquery horizontal accordion

有时候需要的功能很简单,不需要动不动就几千行的插件,就像这个水平手风琴效果。 html code Freebies Download free files to make your job easier. Tutorials Tips and tricks to help you keep up with the latest technology. Inspiration Get inspired by what …

昨夜梦回

(故事大纲) 一切都开始与2012—03—04凌晨的一条短信 我决定了,我要去福州,梅武剑也赞同了,说他可以陪我一起去 我们决定了四月的一天去,当我们准备下地铁去火车站的时候,才发现陪我去的人变成了朱国淼

.htaccess 完全手册

1.时区设置 有些时候,当你在PHP里使用date或mktime函数时,由于时区的不同,它会显示出一些很奇怪的信息。下面是解决这个问题的方法之一。就是设置你的服务器的时区。你可以在这里找到所有支持的时区的清单。 [code]SetEnv TZ Australia/Melbourne[/code] 2. 搜索引擎友好的301永久转向方法 为什么这是搜索引擎友好的呢?因为现在很多现代的搜索引擎都有能根据检查301永久转向来更新它现有的记录的功能。

2012年的第一天,我在厦门

这已经是一个半月前的事了,2011年的最后一个晚上的最后一小时,我乘坐厦门航空抵达了厦门。 2012年的第一天我独自一人逛了鼓浪屿,就这样,平平淡淡度过了本年度的第一天。

让Qtranslate 支持 Custom Taxonomy

If you wanted to automatically detect taxonomies, and then add translation edit fields here is some code: 如果你想要自动探测 Custom Taxonomy,然后给他们加上翻译字段, 把这段代码放在主题的 function.php 里。 function qtranslate_edit_taxonomies(){ $args=array( ‘public’ => true , ‘_builtin’ …