wordpress 中自定义字段功能
一、打开自定义字段功能
二、添加自定义字段和对应值
三、模板文件对应位置添加语法(有两种简单的办法):
1、the_meta() 模板函数。会自动输出一个无序列表:
- Key1: Value of “Key1″
- Key2: Value of “Key2″
- Key3: Value of “Key3″
2、get_post_meta($post_id, $key, $single = true) 函数。根据自己的需求列出自定义字段。
eg: <?php echo 'get_post_meta($post->ID,'mood'.$single = true)'; ?>