开发者

if author meta is empty

开发者 https://www.devze.com 2023-02-01 17:49 出处:网络
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

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

精彩评论

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

关注公众号