WordPress判断自定义域有值才显示

以自定义域的名称为spydance为例

1
2
3
4
5
6
7
$spydance = get_post_meta($pid, 'spydance', true);

<?php if(isset($spydance ) && $spydance != "") : ?>
 有值需要显示的内容
<?php else : ?> //有值显示
没有值需要显示的内容//没有值显示
<?php endif; ?>

Leave a Reply

You must be logged in to post a comment.

RSS feed for comments on this post. TrackBack URL