1
I가 특정 태그로부터 랜덤 게시물을 생성하는 코드 여기, PHP
global $post;
$postid = $post->ID;
$args = array(
'orderby' => 'rand',
'showposts' => 10,
'tag' => 'ABC',
'post__not_in' => array($postid)
);
query_posts($args);
echo '<ul>';
while (have_posts()) : the_post();
echo '<li><a href="'.get_permalink().'" title="'.the_title('','',false).'">'.the_title('','',false).'</a></li>';
endwhile;
echo '</ul>';
나 변수에 ABC를 저장할 때 태그가 'ABC'이지만,
그렇게 이유$tagABC = 'ABC';
후이 방법을 작동하지 않습니다
global $post;
$postid = $post->ID;
$args = array(
'orderby' => 'rand',
'showposts' => 10,
'tag' => $tagABC,
'post__not_in' => array($postid)
);
query_posts($args);
echo '<ul>';
while (have_posts()) : the_post();
echo '<li><a href="'.get_permalink().'" title="'.the_title('','',false).'">'.the_title('','',false).'</a></li>';
endwhile;
echo '</ul>';
여기에 변수 전화, 누군가가 설명 할 수 있을까?
나는 다음 오류를 찾아 :) :) 문제가 거기에 없었습니다. –