« iPhone – Die App Bump ist sehr kommunikativ PHP – whitespaces aus HTML entfernen und gzip aktivieren »
WordPress – attachment PDF’s auflisten
Januar 18th, 2011
Ich habe mir eine kleine Funktion programmiert mit der ich attachments auflisten lasse, um ein einheitliche darstellung der Dateien zu
Der PHP code wird einfach mit in das Template eingebunden oder in eine Function integriert.
1 2 3 4 5 6 7 8 | $pdfs = get_posts(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'application/pdf', 'numberposts' => 1000)); if($pdfs): echo '<div class="filelist">'; foreach($pdfs as $pdf): echo '<a href="'.wp_get_attachment_url($pdf->ID).'" title="'.$pdf->post_title.'" target="blank" class="pdf_download">Download: '.$pdf->post_title.'</a><br/>'; endforeach; echo '</div>'; endif; |
Schreiben Sie einen Kommentar
