拾点灵犀
使用get-post-meta自定义字段调用内容

做人联盟站,需要用到首页调用链接与价格,刚开始只想着去找插件实现,找了一夜,没找到,晕乎 ::(怒) 都忘记用自定义字段这个功能了。以下是用到的两个字段,记录一下。

1
2
3
4
5
6
<?php if(get_post_meta($post->ID, "check it out", $single = true) != ""){ ?>
<div id="read-more-container">
< a href="<?php echo get_post_meta($post->ID,"check it out", $single = true);?>">
Check It Out</ a>
</div>
<?php } ?>
1
2
3
4
5
6
7
8


<?php if(get_post_meta($post->ID, "check it out", $single = true) != ""){ ?>
<div id="read-more-container">
< a href="<?php echo get_post_meta($post->ID,"check it out", $single = true);?>">
<?php echo get_post_meta($post->ID,"price", $single = true);?></ a>
</div>
<?php } ?>```
署名 - 非商业性使用 - 禁止演绎 4.0