
內容簡介
此外掛可以幫助您手動重新排序或排序貼文、自訂貼文類型或網頁所附加的圖片。安裝並啟用後,您可以選擇要在哪個貼文類型或網頁使用此功能。該特定貼文或網頁所附加的所有圖片將會列在管理員的貼文編輯頁面上。然後,您可以拖放圖片以您想要的方式進行排序。
這將僅影響上傳到特定貼文或網頁中的圖片。
使用此短代碼將圖片插入到貼文/頁面中:[list_attached_images]
以下是一些參數:
圖像大小:如縮略圖、中型、大型
圖像數量:如-1、0、5
圖像連結:連結到圖像文件- 假/真
排序:如desc、asc
清單樣式:使用您自己的樣式
示例:
[list_attached_images imagesize=”large” numberimages=”3″ imagelink=”true” order=”asc” listclass=”my-images”]
以下是可以幫助您在主題中顯示圖片的 PHP 代碼:
$thumb_id = get_post_thumbnail_id( get_the_ID() );
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image/jpeg',
'orderby' => 'menu_order',
'numberposts' => -1,
'order' => 'ASC',
'post_parent' => get_the_ID(),
'exclude' => $thumb_id // Exclude featured thumbnail
);
$attachments = get_posts($args);
if ( $attachments ) :
foreach ( $attachments as $attachment ) :
echo wp_get_attachment_image( $attachment->ID, 'full' );
endforeach;
endif;
網站
外掛標籤
開發者團隊
原文外掛簡介
This plugin will help you manually reorder or sort the images attached to your post, custom post type or page. Once installed and activated you can choose which post type or page you want this functionality on. All the images attached to that specific post or page will then be listed on the post-edit page in the admin. You will then be able to drag & drop the images in the order you want them to be listed.
This will only affect those images uploaded to the specific post or page.
Insert images into post/page with this shortcode: [list_attached_images]
Her are some parameters
imagesize: ie. thumbnail, medium, large
numberimages: ie. -1, 0, 5
imagelink: link to the image file – false/true
order: ie. desc, asc
listclass: use your own class
Example:
[list_attached_images imagesize=”large” numberimages=”3″ imagelink=”true” order=”asc” listclass=”my-images”]
Here is the php code that will help you display the images in your theme:
$thumb_id = get_post_thumbnail_id( get_the_ID() );
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image/jpeg',
'orderby' => 'menu_order',
'numberposts' => -1,
'order' => 'ASC',
'post_parent' => get_the_ID(),
'exclude' => $thumb_id // Exclude featured thumbnail
);
$attachments = get_posts($args);
if ( $attachments ) :
foreach ( $attachments as $attachment ) :
echo wp_get_attachment_image( $attachment->ID, 'full' );
endforeach;
endif;
Website
