[WordPress] 外掛分享: All Inclusive

WordPress 外掛 All Inclusive 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「All Inclusive」是 2010-10-31 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2022-01-09,距離現在已有 1211 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 5.8 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

stur |

外掛標籤

meta | post | image | posts | thumbnail |

內容簡介

這個外掛會加入兩個額外的 SQL 查詢,將原始的資料樣本 $wp_query->posts 與所有的 meta 欄位、所有的檔案和圖片結合起來,對於每一張圖片,會形成直接連結到小型、中型和大型圖片的網址。無需使用函數 the_post_thumbnail 和 get_post_meta。

運作方式

讓我們假設我們前往部落格首頁,WordPress 會給我們一個最新 10 篇文章的清單。讓我提醒一下,這些已經在全域物件中的陣列 $wp_query->posts 中了。讓我們從創建 ID 列表開始(將每個文章記錄存在資料庫中的編號數)。

形成第一個 SQL 查詢:

$query = “SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_parent IN(’21’,’29’,’30’,’35’,’38’,’42’,’46’,’48’,’49’,’55’) AND $wpdb->posts.post_parent
AND $wpdb->posts.post_type = ‘attachment'”;

一個正常的翻譯是「尋找編號為('21 '、'29 '、'30 '、'35 '、'38 '、'42 '、'46 '、'48 '、'49 '、'55')的所有子項目」。所需類型的記錄是「附件」。換句話說,我們找到了我們為 10 篇文章下載的所有檔案(附件)。

再次形成 ID 列表:前 10 個 ID 記錄和檔案(附件)的 ID。檔案(附件)作為普通的記錄都存在 wp_posts 這個表中。

現在我們使用函數 update_meta_cache:

$all_meta = update_meta_cache(‘post’, $ar_all_id);

$ar_all_id-這裡是原始的記錄和檔案(附件)

這樣一切就進入了快取,後續的調用 get_post_meta 將從快取中提取值。其餘的都是技術問題 - 資料必須小心整理,不要混淆任何內容。所有的 meta 欄位都被添加到 $post->meta 陣列中,並將檔案添加到 $post->files 陣列中,並立即按照編號順序對文件進行排序(下載時,可以指定排序順序)。

此外,對於每個檔案,如果它是圖片,就會計算縮略圖的完整路徑:小型(縮略圖)、中型(中等大小)和完整的圖片。

WordPres 4:

預設篩選器僅使用 is_main_query() 連接到主查詢。
不適用於 is_admin() 或 is_page()。

主頁
俄文頁面

簡要的 Markdown 示例

更多 PHP 代碼示例
更多示例

原文外掛簡介

The pluginplug-in, with two additional SQL queries, joins the original data sample $wp_query->posts all meta fields, all files and images, for each image the direct url to small, medium, and large image is formed. There’s no need to use functions the_post_thumbnail and get_post_meta.
How it works
So let’s say we go to the home page of our blog, WordPress gives us a list of the latest 10 records. Let me remind you these are already in the global object in the array $wp_query-> posts. Let’s begin from creating a list of ID (number of records to which they are stored in the database).
Form the first SQL query:

$query = “SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_parent IN(’21’,’29’,’30’,’35’,’38’,’42’,’46’,’48’,’49’,’55’) AND $wpdb->posts.post_parent
AND $wpdb->posts.post_type = ‘attachment'”;

A normal translation is «find all the child entries for entries with the numbers (’21 ‘, ’29?, ’30 ‘, ’35?, ’38 ‘, ’42?, ’46 ‘, ’48?, ’49 ‘, ’55 ‘)». And the type of records required to be «attachment». That is, in short, we find all the files (attachment) which we downloaded for our 10 entries.
Again we form a list of ID: the first 10 ID entries and add the ID of files (attachments). Attachments as ordinary records are stored in one table – wp_posts.
Now we use the function update_meta_cache:

$all_meta = update_meta_cache(‘post’, $ar_all_id);

$ar_all_id – here are the original recordings and attachments
So everything just gets in the cache and subsequent calls get_post_meta will derive value from the cache. The rest is a matter of technique – the data must be carefully arranged, not mixing anything up. All meta fields are added to the $post->meta array, and files into an $post->files array and files are immediately sorted by number order (when downloading it, you can specify the sort order).
In addition, for each file, if it is an image, the full path to the thumbnails is calculated: small (thumbnail), average (medium) and the complete picture (full).
WordPres 4:
The default filter is only connected to the main query using is_main_query().
Does not work in is_admin() or is_page().
Home page
Русская страница
A brief Markdown Example
More PHP code Examples
Больше примеров

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「All Inclusive」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


最新版本

延伸相關外掛(你可能也想知道)

  • Image Optimization by Optimole – Lazy Load, CDN, Convert WebP & AVIF, Optimize Images 》, Optimole的獨特之處在哪裡?, , 更小的圖片,同樣的品質, 完全自動化;設定一次就忘記它, 支援所有圖片格式, 支援Retina和WebP圖片, 以機器學習為基礎的自...。
  • Imsanity 》使用 Imsanity,自動調整大型圖片上傳大小。選擇你喜歡的尺寸和品質,讓 Imsanity 完成其餘所有工作。當投稿者上傳大於配置尺寸的圖片時,Imsanity 將自動將...。
  • Firelight Lightbox 》Easy FancyBox WordPress外掛為您的網站提供靈活美觀的光箱解決方案,幾乎適用於網站上的所有媒體連結。Easy FancyBox使用更新的傳統FancyBox jQuery擴展版本...。
  • Simple Lightbox 》Simple Lightbox 是一個非常簡單且可自定義的燈箱,在您的 WordPress 網站上添加它非常容易。, 功能, 自定義燈箱行為的選項位於外觀 > Lightbox 管理員菜...。
  • Robin image optimizer — save money on image compression 》需要專業支援嗎?, 開始免費支援, 開始高級支援, 透過減少圖像大小,讓您的網站加快速度。我們的 WordPress 圖像優化外掛,可以將圖像大小減少80%,而且不損...。
  • Responsive Lightbox & Gallery 》提供完整的 WordPress 相簿外掛所需一切, Responsive Lightbox and Gallery 外掛是一個全功能的 WordPress 相簿外掛,擁有強大的拖放相簿生成器和 Lightbox ...。
  • reSmush.it : The original free image compressor and optimizer plugin 》reSmush.it Image Optimizer 是一個 WordPress 外掛,透過 reSmush.it API 提供圖片優化服務。reSmush.it 使用多種高級演算法對圖像進行大小減小。API 支援最...。
  • Menu Image, Icons made easy 》這個外掛可以輕鬆地在選單項目中加入圖像或圖示,打造更好的網站選單。, 可以控制圖像或圖示的位置以及大小。, 這個 Menu Image 外掛還有其他功能,以下是其...。
  • Image Widget 》Image Widget 是一個簡單的外掛程式,利用 WordPress 原生媒體管理員,為您的網站新增圖片小工具。, 需要新增幻燈片、燈箱或隨機圖像嗎?, 請查看 Image Widg...。
  • Featured Image from URL (FIFU) 》h3>WordPress 外掛 - 用於顯示外部特色圖片、影片、音訊等等, FIFU 自 2015 年來已幫助全球數千個網站節省了儲存空間、處理時間和版權費用。, 如果您已經厭倦...。
  • Default Featured Image 》在媒體設定頁面上新增一個預設的特色圖像。如果沒有設定任何特色圖像,這個預設的特色圖像就會顯示。就這麼簡單。, 查看常見問題以獲取基本問題資訊。, 如果...。
  • All In One Favicon 》查看最新的WordPress交易以優化您的網站。, All In One Favicon為您的網站和管理頁面添加favicon。, 您可以使用您已經上傳的favicon或使用內置的上傳機制將fa...。
  • ImageMagick Engine 》透過讓 WordPress 使用 ImageMagick 而非標準的 GD 圖像庫,大幅提升重新調整大小的圖像品質。, 功能, , 在重新調整大小的圖像中保留嵌入式色彩設定檔, 自動...。
  • WP Featherlight – A Simple jQuery Lightbox 》WP Featherlight 是一個 WordPress 外掛,可為您的WordPress 網站添加一個極簡、高效、響應式 jQuery 燈箱。在其核心,WP Featherlight是一個用於 Featherlig...。
  • Phoenix Media Rename 》通過使用「Phoenix Media Rename」外掛,將您的媒體檔案重新命名,極大地提高您的 SEO。, 在Phoenix Media Rename 官方頁面上提供了完整的使用和設置指南。。

文章
Filter
Apply Filters
Mastodon