Wykluczanie zdjęć z galerii na blogu
-
Witam,
mam problem z szablonem. Nad postem mam slider do publikacji obrazów wpisów. Chcę zrobić tak, by wyświetlało się tylko jedno zdjęcie główne, które stanowi ikonę wpisu a obecnie wyświetla wszystkie zdjęcia jakie mam we wpisie.W szablonie znalazłem kod odpowiadający za slider
<?php //find images in the content with "wp-image-{n}" in the class name preg_match_all('/<img[^>]?class=["|\'][^"]*wp-image-([0-9]*)[^"]*["|\'][^>]*>/i', get_the_content(), $result); $exclude_imgs = $result[1]; $args = array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'exclude' => $exclude_imgs, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1, ); $attachments = get_posts($args); if ($attachments) { echo "<div class='gallery-wrap'><div class='flexslider'><ul class='slides'>"; foreach ($attachments as $attachment) { echo "<li> <a href='". get_attachment_link($attachment_id) ."'>"; echo wp_get_attachment_image($attachment->ID, 'large+image', false, false); echo "</a></li>"; } echo "</ul></div></div>"; } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- Temat ‘Wykluczanie zdjęć z galerii na blogu’ jest zamknięty na nowe odpowiedzi.