admin管理员组文章数量:1208155
I've had a good look thru the Similar Questions for an answer and i'm looking to check if a value for a custom field key on single posts has been added using get_post_meta();
however i want to use this check on the author archive page.
This is my code in functions.php
global $wp_query;
$post = $wp_query->get_queried_object_id();
$meta = get_post_meta( $post->ID, 'key', true );
if ( $meta ) :
Update : This function doesn't work on the author archive page.
function author_has_name() {
global $post;
$name = get_post_meta ($post->ID, 'author_name', true);
return !empty($name);
}
However, the code won't work in the author.php template
本文标签: post metaCheck For getpostmeta on Author Archive Page
版权声明:本文标题:post meta - Check For get_post_meta on Author Archive Page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738732861a2109424.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论