0
나는 다음과 같은 코드가 있습니다 기본적으로 나는 post.I 지금 또한 얻을에만 해당 게시물 query_posts('posts_per_page=1&cat=1');
의 attachements을 얻고 싶은 목록을 어디에만이 게시물에 대한 attachements을 얻기
<?php
include('includes/index.php');
get_header();
?>
<section>
<div class="text">
<?php
while (have_posts()):
the_post();
if (get_the_title() == 'Archive') query_posts('posts_per_page=1&cat=1');
$category = get_the_category();
if ($category[0]->name) echo '<h1>'.$category[0]->name.'</h1>';
$attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image'));
foreach ($attachments as $attachment_id => $attachment):
$image = wp_get_attachment_url($attachment_id, 'medium');
echo $image."<br />";
endforeach;
the_content();
endwhile;
?>
<?php edit_post_link('Click here in order to edit this page'); ?>
</div><!--END /.text-->
</section>
</div><!-- end clearfix-->
<?php get_footer(); ?>
이 코드는 page.php
에를 페이지 첨부 파일. 어떻게 할 수 있습니까?
:
출처 : 그것은 (
query_posts
유사)get_posts
의 사용 현재 게시물의 모든 첨부 파일을 검색 할 수를 보여줍니다 특정 게시물. http://codex.wordpress.org/Function_Reference/WP_Query를 참조하십시오. – hakre