Hier ein einfacher Code-Schnipsel, um Attachments (Dateianhänge) in einem WordPress-Theme anzuzeigen.
$args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { echo apply_filters('the_title', $attachment->post_title); the_attachment_link($attachment->ID, false); } }
Fügt einfach den folgenden Code innerhalb eines WordPress Loops ein und deine Dateianhänge werden angezeigt.
Desweiteren ist es auch möglich den Code irgendwo in die post.php Datei einzufügen.
Credit: wprecipes.com
Kategorie wordpress
Add your Comment
Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>