Custom MetaBoxes 2을 사용하여 이미지 업 로더 필드를 만듭니다. 내가 전면에 그 이미지를이 필드에 업로드 된 이미지를 검색하지만, 특정 크기 (예 : "전체"에 대한)을 표시 할 수있는 방법워드 프레스에서 특정 크기의 맞춤 필드 이미지를 검색하십시오.
$meta_boxes['home_page_slider'] = array(
'id' => 'home_page_slider',
'title' => __('Home Page Slider', 'cmb2'),
'object_types' => array('page',), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'show_on' => array('id' => array(5,)), // Specific post IDs to display this metabox
'fields' => array(
array(
'name' => __('Slider Images', 'cmb2'),
'desc' => __('Upload or add multiple images/attachments.', 'cmb2'),
'id' => $prefix . 'slider-images',
'type' => 'file_list',
'preview_size' => array(100, 100), // Default: array(50, 50)
),
)
);
: 여기
은 METABOX 코드입니다 다음 HTML 마크 업에서 끝내시겠습니까?<ul class="slides">
<li>
<img src="images/awn1.jpg" />
</li>
<li>
<img src="images/awn2.jpg" />
</li>
<li>
<img src="images/awn3.jpg" />
</li>
</ul>
답장을 보내 주셔서 감사합니다.이 예제를 보았지만 동일한 아이디어가 '형식'=> '파일 목록'에서 작동하는지 확실하지 않았고 목록 항목을 계속 추가하기 위해 동적으로 만드는 방법을 궁금합니다. 클라이언트가 파일 목록에 새 이미지를 업로드 할 때마다 태그가 내부에 있습니다. –