첨부 된 모든 이미지를 특정 게시물에 표시 할 수있는 방법이 있습니까? 나는 Nivo Slider jQuery 플러그인을 사용하여 이미지를 추가하는 현명한 방법을 찾고 있습니다. 가장 좋은 점은 게시물을 만든 다음 슬라이더에 원하는 이미지를 첨부하는 것입니다. 그래서 필요한 것은 특정 포스트에서 첨부 된 모든 이미지를 반복하는 일종의 루프입니다.Wordpress posts - attached images
1
A
답변
1
global $post;
$attachements = query_posts(
'post_type' => 'attachment',
'post_parent' => $post->ID, // or static id, i.e. 7
'posts_per_page' => -1
);
foreach($attachements as $attachment){
$thumbimg = wp_get_attachment_link($attachment->ID, 'thumbnail-size', true);
echo $thumbimg;
}
+1
고마워! 매력처럼 일했습니다. –
+0
동일한 코드를 사용 했습니까? 일부 오타가있을 수 있습니다. 실수로 코드에 잘못 입력했을 수 있습니다. –
+0
[구문 분석 오류 : 구문 오류, 예기치 않은 T_DOUBLE_ARROW PHP] (http://stackoverflow.com/questions/2622624/parse-error-syntax-error-unexpected-t-double-arrow-php). –
관련 문제
- 1. Wordpress Query Posts Taxonomy
- 2. 홈페이지에 styling wordpress posts
- 3. 자료 Wordpress posts to xml
- 4. wordpress posts 이미지 확대 mouseover
- 5. Wordpress - fav posts 기능을 만드는 방법
- 6. Multipart posts upload images - 전송 인코딩 설정, 각 부품의 헤더 설정
- 7. Rails 3.1.3 posts/index에서 posts/index/posts/show/id에 link_to 태그로 앵커 속성 사용
- 8. CKEDITOR ajax posts
- 9. Toggle Jquery form Posts
- 10. jQuery posts 로딩
- 11. Authorize.Net DPM & Silent posts
- 12. RadEditor posts in firefox
- 13. NoMethodError in posts # show
- 14. images /와 ./images/의 차이점은 무엇입니까?
- 15. Linq to Attached Entity Objects 삽입
- 16. 마지막 fb posts & tweets 받기
- 17. authlogic 및 posts for current_user
- 18. [CSS, JavaScript, Images, CSS-Images] 링크가있는 웹을 가져올 수 있습니까?
- 19. domain.com/images/을 @/images /와 (과) 대체 할 수 있습니까?
- 20. src = "/ images/logo.gif"와 src = "images/logo.gif"의 차이점은 무엇입니까?
- 21. Wordpress 이미지 URL을 가져옵니다 (현재 wp_get_attachment_url을 사용 중입니다)
- 22. Jquery traversing images
- 23. iphone uipickerview with images
- 24. php resize images 스크립트
- 25. php xpath images
- 26. Docbook, Images, ANT
- 27. OpenFlow :: Howto Stream Images
- 28. ListView with images
- 29. Aspose.Words - MailMerge images
- 30. Photoswipe with base64, Images
아,이 포럼에 새. 내가 정답을 표시해야한다는 것을 몰랐습니다. 알림 주셔서 감사합니다 –