
前言介紹
- 這款 WordPress 外掛「Gravity Forms: Post Updates」是 2014-05-16 上架。
- 目前有 300 個安裝啟用數。
- 上一次更新是 2015-07-02,距離現在已有 3891 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.6.1 以上版本才可以安裝。
- 有 13 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
ekaj | jcow | jr00ck | p51labs |
外掛標籤
Frontend | front end | update posts | gravity forms |
內容簡介
需要 PHP 5.3 或更高版本
允許您在前端使用 Gravity Forms 更新任何文章。如果使用 "Gravity Forms + Custom Post Type" 外掛,甚至可以更新自定義文章類型和使用自定義分類法。
功能
支援現有項目的自定義欄位檔案上傳和刪除,並提供縮略圖或 MIME 類型圖示。
修正了多重選擇和複選框上的問題。
修正了分類方面的錯誤。
完全刪除了刪除文章的功能。
現在提供了一些自定義篩選器。
新增了非查詢變數模板方法來設置表單。
新增了一個非常基本的捷徑(更新:雖然此方法仍有支援,但使用 gravityform 捷徑加入 "update" 屬性會更好)。
追加了一個額外的屬性到 gravityform 捷徑: "update"
簡碼
[gravityform id="1" update] // 載入目前文章進行編輯
[gravityform id="1" update="34"] // 載入 ID = 34 的文章進行編輯
我們與 Gravity Forms 的製作者 Rocketgenius 合作增加了一個小升級,使我們可以擴展其簡碼,因此現在您可以僅需將 "update" 屬性添加到普通的 "gravityform" 簡碼中即可。如果只添加 "update",則會載入目前的文章進行更新。如果在更新屬性中添加一個整數,則會使用該 ID 載入文章。
URL 查詢變數
原理上與之前相似,但現在需要一個一次性使用代幣 (Nonce) 才能啟用。
因此,您應該使用動作 (Action) 來建立您的連結。
do_action('gform_update_post/edit_link');
do_action('gform_update_post/edit_link', array(
'post_id' => $post->ID,
'url' => home_url('/edit_post/'),
) );
引數 (查詢變數或陣列)
post_id (int) (選填) 您要編輯的文章 ID。預設:global $post->ID
url (string|int) (選填) 編輯表單所在頁面的完整 URL,或編輯表單所在頁面或文章的 ID。預設:get_permalink()
text (string) (選填) 連結文字。預設:“編輯文章”
title (string) (選填) 錨點標籤的標題屬性。預設:(text) 參數
只取得 URL
這將會返回一個基本的編輯 URL。
apply_filters('gform_update_post/edit_url', '');
指定要編輯的文章 (post_id) 和包含編輯表單的文章 (url)
apply_filters('gform_update_post/edit_url', 1, home_url('/edit_post/'));
捷徑以顯示編輯連結
[gform_update_post_edit_link]
指定要編輯的文章 (post_id) 和包含編輯表單的文章 (url)
[gform_update_post_edit_link post_id=1 url=6]
在範本中
您可以使用動作來強制表單顯示特定的文章:
do_action('gform_update_post/setup_form');
do_action('gform_update_post/setup_form', $post->ID);
do_action('gform_update_post/setup_form', array('post_id' => $post->ID, 'form_id' => $form_id));
參數
post_id (int|array) (選填) 要編輯的文章 ID 或帶有文章 ID 和/或表單 ID 的陣列。這使您可以指定表單 ID,以便不讓更新功能影響其他地方。
原文外掛簡介
Requires PHP 5.3 or greater
Allows you to use Gravity Forms to update any post on the front end. If you use the “Gravity Forms + Custom Post Types”, you can even update custom post types and use custom taxonomies.
Features
Supports custom field file uploading and deletion with thumbnails or mime type icons for existing items.
Fixed a bugs on multi selects and checkboxes.
Fixed bug on Categories.
Completely removed the ability to delete posts.
There are some filters to customize things now.
Adds non-query-var template method to setup a form.
Adds a really basic shortcode to setup a form (UPDATE: This is still supported, but it is better to use the addition, below, to the gravityform shortcode).
Adds an additional attribute to the gravityform shortcode: “update”
SHORTCODE
[gravityform id="1" update] // Loads current post for editing
[gravityform id="1" update="34"] // Loads post where ID=34 for editing
We worked with Rocketgenius, makers of Gravity Forms, to get a small upgrade added that allows us to extend their shortcode, so now you can simply add the “update” attribute to the normal “gravityform” shortcode. If you only add “update”, it will load the current post in to update. If you add an integer to the update attribute, it will use that to load a post by its ID.
URL QUERY VARIABLE
At the heart, it is pretty similar to how it was, but now there is a nonce required to activate it.
So you should use the action to create your links.
do_action(‘gform_update_post/edit_link’);
do_action(‘gform_update_post/edit_link’, array(
‘post_id’ => $post->ID,
‘url’ => home_url(‘/edit_post/’),
) );
Arguments (query string or array)
post_id (int) (optional) The id of the post you want to edit. Default: global $post->ID
url (string|int) (optional) Either the full url of the page where your edit form resides, or an id for the page/post where the edit form resides. Default: get_permalink()
text (string) (optional) The link text. Default: “Edit Post”
title (string) (optional) The title attribute of the anchor tag. Default: (text) parameter
Get just the URL
This will return a basic edit url
apply_filters('gform_update_post/edit_url', '');
Specify post to edit (post_id) and post that holds the edit form (url)
apply_filters('gform_update_post/edit_url', 1, home_url('/edit_post/'));
Shortcode to show the edit link
[gform_update_post_edit_link]
Specify post to edit (post_id) and post that holds the edit form (url)
[gform_update_post_edit_link post_id=1 url=6]
IN TEMPLATE
You can use the action to force a form show a specific post:
do_action('gform_update_post/setup_form');
do_action('gform_update_post/setup_form', $post->ID);
do_action('gform_update_post/setup_form', array('post_id' => $post->ID, 'form_id' => $form_id));
Parameters
post_id (int|array) (optional) The id of the post you want to edit or an array with post id and/or form id. This allows you to specify the form id, so that update functionality does not get applied to other forms on the page. Default: global $post->ID
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Gravity Forms: Post Updates」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.2 | 1.2.4 | 1.2.5 | 1.2.6 | 1.2.7 | 1.2.8 | 1.2.9 | trunk | 1.2.10 | 1.2.11 | 1.2.13 | 1.2.14 | 1.2.16 | 1.2.17 | 1.2.18 | 1.2.20 | 1.2.22 | 1.2.23 |
延伸相關外掛(你可能也想知道)
Schedule Post Changes With PublishPress Future: Unpublish, Delete, Change Status, Trash, Change Categories 》e use of the WordPress cron system in order to schedule future actions. When a post reaches its scheduled action date, the plugin will trigger the ...。
Content Freshness 》**總結:**, 透過 Content Freshness 外掛,您可以輕鬆查看需要更新的文章,並了解它們的最後修改日期,讓您可以及時進行更新。此外,您可以選擇更新內容的時...。
