2014-07-13 2 views
0

내가 원하는 배열 부분을 에코하는 데 문제가 있습니다 (get_comments() 워드 프레스 기능 사용). 나는 그것에 대해 읽어 봤는데하지만이 일을 얻을 수가 있습니다 :WP get_comments() 배열의 반향 부분

$args = array(
'meta_value' => 'tagline111' 
); 

echo get_comments($args[comment_content][0]); 

하지만 난 그냥 얻을 : "Array"

내가 해봤 모든 어떤 방법 : 괄호 외부 배치 안에 [] 배치를 ... 이중 괄호를 사용하여, 주변에 인용

print_r(get_comments($args)); 내가이 : 내가 잘못 뭐하는 거지

Array ([0] => stdClass Object ([comment_ID] => 8 [comment_post_ID] => 367 
[comment_author] => pppaul [comment_author_email] => [email protected] [comment_author_url] 
=> [comment_author_IP] => 127.0.0.1 [comment_date] => 2014-07-13 06:41:11 
[comment_date_gmt] => 2014-07-13 06:41:11 [comment_content] => some content 
[comment_karma] => 0 [comment_approved] => 1 [comment_agent] => Mozilla/5.0 (Windows 
NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0 [comment_type] => [comment_parent] 
=> 0 [user_id] => 1 [meta_id] => 28 [comment_id] => 8 [meta_key] => referance2 
[meta_value] => tagline111)) 

?

+0

결과가 목적이기 때문에. – MH2K9

답변

2

시도 :

$args = array(
    'meta_value' => 'tagline111' 
); 

$comments = get_comments($args); 

foreach($comments as $comment) : 
    // echo something 
endforeach; 
+0

이 항목 수준 물건을 알고 있지만 ... 만약 내가 [comment_content] 값을 에코하려는 루프 내에서 에코합니까? – PhilD

+0

'$ comment'는 객체이므로 다음과 같이 주석 내용을 echo 할 수 있습니다 :'echo $ comment-> comment_content;'[here] (http://codex.wordpress.org/Function_Reference/get_comments#Returns) 에코 할 수있는 개체 속성 목록입니다. – henrywright

관련 문제