无需将下载内容插入帖子中,正如@kaiser所说,您可以自动执行以下操作:
$download = get_children( \'post_type=attachment&post_mime_type=application/pdf&post_parent=\'.$post->ID );
if ($download) {
foreach ( $download as $attachment_id => $attachment ) {
echo \'<a href="\'.wp_get_attachment_url($attachment_id).\'" target="_blank" class="download">Download PDF</a>\';
}
}