开发者

if author meta is empty

i am developing a multiauthor website using wp. I want to out put autho开发者_如何学JAVAr meta in the single page. The output is working fine but to make it better, i want to output something else if the field is empty, especially for field that is not required such as website, twitter or facebook.

Basically i use this to output the field:

<strong>Website:</strong> <a href="<?php the_author_meta( 'website' ); ?>" target="_blank"></a></p>

What i want to do is if the author don't have any website, so i want to output something like "No website"

How to do this? O yes, by default this field in wordpress is not empty, it just have content like "http://"


<?php if(get_the_author_meta('website') != 'http://'): ?>
<strong>Website:</strong> <a href="<?php the_author_meta('website'); ?>" target="_blank"></a></p>
<?php else: ?>
<strong>No website</strong>
<?php endif; ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜