function themeperauthor_need_switch() {
global $post;
if ($get_post_type == 'weblogs') {
return get_the_author_meta('themeperauthor', $user->ID);
}
return "";
}
그것은 아무것도이 코드의 문제점은 무엇입니까?
function themeperauthor_need_switch() {
global $post;
if ($get_post_type == 'weblogs') {
return get_the_author_meta('themeperauthor', $user->ID);
}
return "";
}
그것은 아무것도이 코드의 문제점은 무엇입니까?
get_post_type
function themeperauthor_need_switch() {
global $post,$user;
if (get_post_type($post) == 'weblogs') {
return get_the_author_meta('themeperauthor', $user->ID);
}
return "";
}
또는'$ post'와'$ author'는 매개 변수로서 함수에 전달되어야합니다. 'function themeperauthor_need_switch ($ post, $ user) {' – Treffynnon
예, 답장을 보내 주셔서 감사합니다. – puanthanh
당신은'$의 get_post_type'에 값을 할당나요 글로벌해야하는 함수가 아니라 변수도
$user
객체는 반환하지 않습니다? – soju아무 것도 반환하지 않는다는 것을 어떻게 알 수 있습니까? 뭐라 구요? 해당 함수를 호출 한 코드를 게시하십시오. 어쩌면 오류는 반환 값을 확인하는 코드에있을 수 있습니다. – elitalon