前言介紹
- 這款 WordPress 外掛「Pods AJAX Views」是 2014-06-19 上架。 目前已經下架不再更新,不建議安裝使用。
- 目前有 60 個安裝啟用數。
- 上一次更新是 2020-03-27,距離現在已有 1864 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.9 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.4 以上。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
內容簡介
Pods AJAX Views 提供了一種簡單的方式從 AJAX 生成快取視圖,當它們還沒有被快取時。如果該視圖已經生成,它將直接從緩存提供並輸出到頁面上。
此外掛程式需要運行 Pods Framework 的版本為 2.4.1 或更新版。
為什麼需要 AJAX Views?
如果您正在使用 pods_view 來快取模板輸出,那麼您已經在通過其強大的局部頁面快取來改善網站的性能了。但是,如果您有一個複雜的視圖可能需要幾秒鐘才能生成呢?如果您在同一頁面中有幾個這樣的視圖呢?
在像 WPEngine 這樣的主機上,有一個嚴格的 30 秒限制,然後發送一個 502 伺服器錯誤給訪問者。等待頁面載入很長時間,或者特別是被發送這樣的伺服器錯誤,對訪問者來說是無法接受的,他們可能會選擇退出您的網站。
Pods AJAX Views 可以將這些複雜的視圖轉嫁到單獨的異步 AJAX 請求中,這允許頁面的其餘部分進行構建和發送到瀏覽器。當 AJAX 請求運行時,該視圖像通常一樣被快取,因此對 Pods AJAX View 代碼的後續呼叫將產生與默認 pods_view 相同的結果。
用法
使用方式與 pods_view 相同,它接受相同的參數,除了一個額外的參數 $ forced_regenerate,它可以設置為 true(預設值為 false),這將強制刪除快取的視圖並重新載入。
pods_ajax_view('my-big-cached-template.php');
AJAX 請求是通過相同的 URL 進行的,因此您仍然可以像通常一樣訪問查詢和發佈數據。我們在 template_redirect 中進行鉤取操作,以停止 AJAX 視圖是從 AJAX 載入的,而不是通過當前頁面。它們沒有訪問當前的 WP_Query 或查詢變數,也沒有文章循環。如果您想將任何內容傳遞到其中,請使用 $data 參數。
有關 pods_view 的資訊,請參閱以下資源:
使用 Pods 进行局部页面缓存和智能模板部分
代碼參考:pods_view
可用常數
define('PODS_AJAX_VIEWS_STATS', true) - 创建统计和再生成功能的表格;激活之前必须启用,如果您激活它,只需再次停用/启用即可
define('PODS_AJAX_VIEWS_OVERRIDE', true) - 覆盖主题中的所有 pods_view() 调用并将其转换为 AJAX 视图,即使它们未设置缓存(它将通过 AJAX 加载非缓存版本)
define('PODS_AJAX_VIEWS_API_KEY', 'abcdefghijk') - 随机生成此应高度随机,它是用于访问通过您的网址 /?pods_ajax_view_action=view_sitemap&pods_ajax_view_api_key=XXXX 的站点地图的 API 密钥,必须通过用户(或匿名用户)访问,再生可能是因为 URL 对于用户而言是具体的,并且具有非数值。参数;您可以将其与插件一起使用,例如 Warm Cache,以保持视图始终新鲜且始终生成
define('PODS_AJAX_VIEWS_SITEMAP_LIMIT', -1) - 您可以覆盖将显示的站点地图项目的数量,默認值為 250
貢獻者
請查看我們的 GitHub,以了解貢獻者列表,或搜索我們的 GitHub 问题,以查看參與添加功能,修復錯誤或報告問題/測試的所有人。
GitHub
原文外掛簡介
Pods AJAX Views offers an easy way to generate cached views from AJAX when they haven’t been cached yet. It will serve straight from cache and output on the page if the view has already been generated.
This plugin requires the Pods Framework version 2.4.1 or later to run.
Why AJAX Views?
If you are using pods_view to cache template output, you’re already on the right track to improving performance of your site through it’s powerful Partial Page Caching. However, what if you have a complicated view that may take a few seconds to generate? What if you have a few of those views on the same page?
On hosts like WPEngine, there’s a strict 30 second limit and then a 502 server error is sent to the visitor. Waiting a long time for a page to load, or especially being sent a server error like that just isn’t acceptable for visitors and they may choose to bail on your site.
Pods AJAX Views takes those complicated views and lets you off-load them into a separate asynchronous AJAX call that allows the rest of the page to be built and sent to the browser. When the AJAX request runs, the view is cached like normal, so subsequent calls to the Pods AJAX View code will produce the exact same result as a default pods_view would.
Usage
Use the same way as pods_view, it accepts the same arguments, except one additional argument $forced_regenerate at the end which can be set to true (default: false) that will force the view to be deleted from cache and reloaded.
pods_ajax_view( 'my-big-cached-template.php' );
AJAX requests are done through the same URL, so you still have access to the query and postdata like normal. We hook into template_redirect to stop Beware that AJAXed views are loaded from AJAX, not through the current page. They do not have access to the current WP_Query or Query variables, or the Post loop. If you want to pass anything into it, use the $data argument.
For information about pods_view, see these resources:
Partial Page Caching and Smart Template Parts with Pods
Code Reference: pods_view
Available Constants
define( 'PODS_AJAX_VIEWS_STATS', true ) – Creates a table for Stats tracking and regeneration ability; Must be enabled before activating, if you enable it, just deactivate / activate again
define( 'PODS_AJAX_VIEWS_OVERRIDE', true ) – Overrides all pods_view() calls in the theme and turns them into AJAX views, even if they aren’t set to cache (it’ll load the non-cached version via AJAX)
define( 'PODS_AJAX_VIEWS_API_KEY', 'abcdefghijk' ) – This should be highly randomized, it’s the API key used to access the sitemap at yoursite.com/?pods_ajax_view_action=view_sitemap&pods_ajax_view_api_key=XXXX which must be accessed through the user (or anon) the regeneration will be run as because the URLs are specific to the user and have nonces on them; You can use this with a plugin like Warm Cache to keep your views fresh and always generated
define( 'PODS_AJAX_VIEWS_SITEMAP_LIMIT', -1 ) – You can override how many sitemap items will show, default is 250
Contributors
Check out our GitHub for a list of contributors, or search our GitHub issues to see everyone involved in adding features, fixing bugs, or reporting issues/testing.
github.com/pods-framework/pods-ajax-views/graphs/contributors
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Pods AJAX Views」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
SearchWP Live Ajax Search 》此 WordPress 外掛不需要SearchWP,但如果有的話就會使用它。在 searchwp.com 可以找到完整文檔。, 歡迎在 GitHub 上貢獻您的力量!https://github.com/jchri...。
AJAX Thumbnail Rebuild 》AJAX Thumbnail Rebuild 可讓您重新建立網站上的所有縮圖。儘管已經有一些插件可供使用,但它們有一個共同點:所有縮圖都會在單一步驟中重新建立。如果您的網...。
WordPress File Upload 》這個外掛讓你或其他使用者可以從任何頁面、文章或側邊欄輕鬆、安全地上傳檔案到你的網站。, 只需要在任何 WordPress 頁面/文章中加入簡碼 [wordpress_file_up...。
WPC AJAX Add to Cart for WooCommerce 》WPC AJAX Add to Cart for WooCommerce 是一款高效的外掛,能幫助線上商店削減網站載入時間、改善用戶體驗並增加銷售額。此外掛允許用戶加入商品至購物車而不...。
Entry Views 》Entry Views 會記錄每篇文章/頁面(或任何文章類型)的瀏覽次數。 它附帶一個小工具,可顯示最受歡迎的文章,一個短代碼可顯示文章的瀏覽次數,以及方便的佈...。
Ajax Cart AutoUpdate for WooCommerce 》這是一個輕巧的外掛程式,在產品數量更改時自動更新購物車頁面和迷你購物車。同時移除了預設的「更新購物車」按鈕,並可以選擇關閉購物車頁面提示訊息。, 特...。
WooCommerce Ajax Cart Plugin 》WooCommerce AJAX Cart 是一款 WordPress 插件,可以更改 WooCommerte 購物車頁面的默認行為,讓買家在更改產品數量時即時查看總價格計算,無需手動點擊 "更...。
pageMash > Page Management 》使用此簡單的 AJAX 拖放管理介面,自訂頁面的排序,並管理父頁面結構,還有可選擇隱藏輸出頁面的選項。是一個快速重排頁面選單的好工具。, 查看範例頁面:htt...。
Load More Anything 》Commerce Products, Custom Div or Anything, , 這款插件能幫助您在 WordPress 網站上載入更多內容。您可以在博客文章、評論、頁面、類別、最新文章、側邊欄...。
Enable CORS 》外掛會收集網站 URL 與啟用的外掛列表,以提供支援。但不會分享給第三方。本外掛可幫助解決CORS問題,讓您輕鬆存取跨域資源。只需幾個簡單點擊,就能在網站上...。
Relevanssi Live Ajax Search 》Relevanssi Live Ajax Search 可以讓你的搜尋表單使用 ajax 即時搜尋。它不會淹沒你的設定,通常不需要做任何修改即可正常運作。如果你想自訂它,你可以完全...。
Infinite-Scroll 》無限捲動(Infinite scroll)也被稱為自動分頁、取消分頁、無限頁面等等。基本上,它是預先從下一個頁面取得內容,並直接將它添加到用戶當前的頁面。, 當用戶...。
Dave's WordPress Live Search 》Dave's WordPress Live Search 可在您的 WordPress 站點中加入「即時搜尋」功能。當訪客在 WordPress 站點的搜尋框中輸入字詞時,該外掛會持續查詢 WordPress...。
Filter & Grids 》使用 AJAX 篩選自定義分類 / 分類標籤來篩選文章或自定義文章類型,無需重新載入頁面,並支持不同的分頁類型。這款外掛允許解決顯示網站頁面上的文章的各種任...。
Ajaxify Comments – Ajax and Lazy Loading Comments 》尋找新的外掛程式維護者 👀, 請注意,此外掛程式已不再維護或支援,我們正在尋找新的外掛程式維護者(請參閱我們的公告 這裡)。 , 介紹, 預設情況下,當使用...。