我需要生成上传到特定页面的附件列表(id=628)。我原以为这段代码会起作用,但它根本不会生成任何东西:
<?php
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
$attachments =& get_children( array (
\'post_parent\' => 628,
\'post_type\' => \'attachment\'
));
if ( empty($attachments) ) {
// no attachments here
} else {
foreach ( $attachments as $attachment_id => $attachment ) {
echo wp_get_attachment_link( $attachment_id );
}
}
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
你知道我该怎么做吗?