2016-10-12 4 views
1

저는 WordPress 코덱스에서 have_posts 함수로 작업하고 있습니다. 난 할 노력하고있어입니다 : WordPress에서 함수 have_posts로 작업하기

while ($content_query->have_posts()) { 

     $content_query->the_post(); 
     if(strpos(the_title(),'Garajes Gran')===false){   
      global $post; 
      include($item_template); 

     } 

     } 

그래서 나는 이름 Garajes 그란하지 않고 목록을 Garajes 그란 이름으로 이름의 전체 목록을 포함하지 내가 잘못 무엇입니까? 또한 String Garajes Gran이있는 첫 번째 위치를 찾는 대신 모든 이름을 출력하므로 if (strpos (the_title(), 'Garajes Gran') === false {은 의미하는 것을하지 않습니다. ?.

미리 감사드립니다.

+0

'echo' 또는'print_r' 변수는 사용하는 값이고 기대 한 값을 가지고 있는지 확인합니다. – RST

답변

0

'the_title()'대신 'get_the_title()'을 사용하십시오.

if(strpos(get_the_title(get_the_ID()),'Garajes Gran')===false){   
    global $post; 
    include($item_template); 
} 

희망하시는 바입니다.