나는 관련 자료를 Wordpress에 게시하고 싶습니다. 이 게시물을 수동으로 선택해야하며 범주 또는 태그를 자동으로 선택하지 않아야합니다. 이전에이 코드를 사용했습니다 :관련 게시물을 Wordpress에 게시 하시길 바랍니다.
<?php $orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=>5, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if($my_query->have_posts()) {
echo '<div id="relatedposts"><h3>Related Posts</h3><ul>';
while($my_query->have_posts()) {
$my_query->the_post(); ?>
<li><div class="relatedthumb"><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a></div>
<div class="relatedcontent">
<h3><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_time('M j, Y') ?>
</div>
</li>
<? }
echo '</ul></div>';
}
}
$post = $orig_post;
wp_reset_query(); ?>
관련 태그에서 잘 선택되지만 관련 게시물을 수동으로 호출해야합니다.
내가 쉼표로 구분 된 목록으로 사용자 정의 필드 'myrelatedposts'에 전화를 걸 포스트 식별자, 예를 들어 뒀다: 103, 104, 105, 122
지금 내가 그들을 호출 할 필요를 위의 스크립트.
배열 (이 게시물은 5 개로 제한됨)에 대한이 게시물 목록을 어떻게 폭발시킬 수 있으며 각 게시물 축소판 및 제목을 호출 할 수 있습니까?
의견을 보내 주셔서 감사합니다.
큰 감사, 나는 그걸로 노력하려고합니다. – Sara44