나는 미디어 라이브러리에서 모든 이미지를 얻으려고이 코드를 시도했지만 모든 이미지의 소스 URL을 성공적으로 받고 있지만 로고, 헤더 이미지 등의 원치 않는 이미지는 모두 제외하고 싶습니다.Wordpress에서 머리글 및 로고 이미지를 제외한 게시물 및 페이지의 이미지를 추출하는 방법은 무엇입니까?
즉 내가
는if(is_single() || is_page() || is_home()){
global $post;
$query_images_args = array(
'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1,'numberposts' => 1
);
$query_images = new WP_Query($query_images_args);
$images = array();
foreach ($query_images->posts as $image) {
$images[]= wp_get_attachment_url($image->ID);
}
echo "<pre>";
print_r($images);
echo "</pre>";
내 출력 여기에 첫 번째 이미지는 나를 ..How 위해 원치 않는 것입니다 헤더 이미지를 사용하여 시도했다 .. 난을 제외하는 것입니다 .. 게시물과 페이지에 연결된 모든 이미지를 추출 할 첨부 파일 크기가 있지만 항상 고유 할 수는 없습니다 .. 살펴보기
Array
(
[0] => http://localhost/wordpress/wp-content/uploads/2013/03/AboutUsSlider.jpg
[1] => http://localhost/wordpress/wp-content/uploads/2013/03/7325996116_9995f40082_n.jpg
[2] => http://localhost/wordpress/wp-content/uploads/2013/03/6310273151_31b2d7bebe.jpg
[3] => http://localhost/wordpress/wp-content/uploads/2013/03/4764924205_ce7470f15a.jpg
[4] => http://localhost/wordpress/wp-content/uploads/2013/03/2166105529_70dd50ef4b_n.jpg
[5] => http://localhost/wordpress/wp-content/uploads/2013/03/1494822863_aca097ada7.jpg
[6] => http://localhost/wordpress/wp-content/uploads/2013/03/1385429771_453bc19702.jpg
)