[WordPress] 外掛分享: custom-post-edit

前言介紹

  • 這款 WordPress 外掛「custom-post-edit」是 2014-10-12 上架。 目前已經下架不再更新,不建議安裝使用。
  • 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
  • 上一次更新是 2014-10-13,距離現在已有 3861 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.0 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

vimes1984 |

外掛標籤

AngularJS forms | wordpress frontend post edit |

內容簡介

這個外掛只針對開發者,它是使用 AngularJS 實現一個簡單的自定義前端發文編輯表單的努力。

我會通過 github 追蹤問題:

https://github.com/vimes1984/custompostedit/

它使用 AngularJS 進行表單,並要求您在表單的 URL 中傳遞一個 $_GET['posttoedit'] 變數,包含您想編輯的文章的 ID。

範例:

http://EXAMPLE.com/?posttoedit=POST_ID_TO_EDIT

你需要更新三個檔案才能啟動它,首先是表單:

這些欄位需要符合以下語法,這裡以 monthlysalary 為例是要傳遞給 PHP 函數的物件:

範例:

檔案:

/includes/customedit.php

然後是 customPostEdit->post_edit_fac() 類別方法,第 237 至 262 行是實際更新文章的函數,並從 javascript 呼叫:

檔案:

customPostEdit.php

你需要填寫這些欄位以更新您想要的欄位,您可以在這裡找到預設欄位:

https://codex.wordpress.org/Database_Description#Table:_wp_posts

您可以像以下這樣更新文章 meta 欄位:

範例:

update_post_meta( $postID, 'wpcf-monthly-salary', $monthlysalary );

最後還有一個檔案您可能需要編輯,那就是 AngularJS 檔案,您可能需要更改:

範例:

$scope.formobject = {'jobID': '', 'title': '', 'jobcontent': '', 'monthlysalary': ''};

物件以符合您表單中的欄位:

檔案:

/js/custom-post-edit.js

這個檔案呼叫我們在第一個檔案中定義的 PHP 端點 post_edit_fac,並從表單將 formobject {} 傳遞到該函數。

您可以使用短代碼將表單放在任何您想要的地方:

短代碼:

[post_edit]

祝您好運,如果有任何問題,請發到 github,我很樂意提供幫助...

原文外掛簡介

This plugin is intented for Developers only it’s a effort to implement a simple custom front end post edit form using angularJS.
I’ll be tracking issues via github:
https://github.com/vimes1984/custompostedit/
It uses angularJS for the form and requires you pass a $_GET['posttoedit'] variable in the url to the form containing the post ID you want to edit.
Example:
http://EXAMPLE.com/?posttoedit=POST_ID_TO_EDIT

You are going to need to update three files to get this up and running first the form:
These fileds need to match the following syntax where in this case monthlysalary will be the object passed to the php function:
Example:

File:
/includes/customedit.php

Then the class customPostEdit->post_edit_fac() method, line 237-> 262 is the function that actually updates the post and is called from the javascript:
File:
customPostEdit.php

you are going to need to fill these in with the fields you want to update you can find the default fields here:
https://codex.wordpress.org/Database_Description#Table:_wp_posts
And you can update post meta fields like so:
Example:
update_post_meta( $postID, 'wpcf-monthly-salary', $monthlysalary );

There is one last file you may need to edit and that’s the AngularJS file you may need to change
Example:
$scope.formobject = {'jobID': '', 'title': '', 'jobcontent': '', 'monthlysalary': ''};

Object to match your form fields in this file:
File:
/js/custom-post-edit.js

This file calls the php endpoint we defined in the first file the post_edit_fac and sends the formobject {} to that function from the form.
You can place the form anywhere you want using the shortcode:
Shortcode:
[post_edit]

Good luck and post any issues to github I’ll gladly lend a hand…

各版本下載點

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

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


1.0.0 | 1.0.1 | 1.0.2 | 1.0.3 | 1.0.4 | 1.0.5 | 1.0.6 | 1.0.7 | 1.0.8 | 1.0.9 | trunk |

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

暫無相關外掛推薦。

文章
Filter
Apply Filters
Mastodon