WordPress Custom Fields 自定义字段使用
by: ponytail @ 06 五 , 2010 in: ┨Skill ,┨Stuuuuuuuudy
wordpress是好物,我的大爱,啥都能做了,最近算是转型期,不知道转不转的过弯来,有用的东西先记录一下~~
1. 设定过期时间
<?php
if (have_posts()) :
while (have_posts()) : the_post(); ?>
$expirationtime = get_post_custom_values(‘expiration’);
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);}
$secondsbetween = strtotime($expirestring)-time();
if ( $secondsbetween > 0 ) {
// For example…
the_title();
the_excerpt();
}
endwhile;
endif;?>








