如何将表重新排列添加到 WordPress 后端? [英] How to Add Table Rearranging to WordPress Backend?

查看:24
本文介绍了如何将表重新排列添加到 WordPress 后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个具有可以在表格中添加/删除/重新排列行的功能的 wordpress 主题.理想情况下,我希望它是一个拖放操作.输出只需是一个带有多个标题行的表格,后跟内容行.这是一个演员的网站,所以它会是一个简历页面.所以 FILM>credits THEATRE>credits

这就是最终产品的样子:

几乎我只是想让用户尽可能轻松地更改他/她的简历.现在我正在使用tinyMCE 中的 add-row-below"按钮,但这可能会让非技术人员感到困惑.

理想情况下,我可以将其添加到 wordpress 内的某个页面,但将其放在主题的设置选项卡中也可以.任何想法、想法、答案都将不胜感激!

解决方案

对于最终用户,我建议使用自定义字段插件解决方案,如下所示

这里有一个完整的例子:同时添加自定义图像字段和其他字段.

I am trying to make a wordpress theme that has a feature where you can add/remove/rearrange rows in a table. Ideally I would want it to be a drag and drop action. The output needs to simply be a table with several header rows, followed by content rows. This is for an actor's website, so it would be for a resume page. So FILM>credits THEATRE>credits

This is what the end product should look like:

Pretty much I'm just trying to make it as easy as possible for a user to change his/her resume. Right now I'm using add-row-below" buttons in the tinyMCE, but that can get kind of confusion for non tech people.

Ideally I would be able to add this to a certain page inside of wordpress, but putting it in a settings tab for the theme would work as well. Any thoughts, ideas, answers would be most appreciative!

解决方案

For an end user, I'd suggest a Custom Fields plugin solution like in this other Answer (using Custom Content Type Manager or Advanced Custom Fields).

Programmatically, a Repeatable Field is the way to go.

This helper library may be of interest, Admin Page Class:

Works with plugins as well as themes
Easily brand-able (via hooks).
Import Export features.
Available fields are:
[...]
Sortable Drag & Drop
Repeater Field which can be set as sortable
OOP Code all the way (which means easy to extend and modify).

A Gist example of Meta Box with a Sortable Repeatable Field --fork

And a full example here at SO: Adding custom image fields and other fields at the same time.

这篇关于如何将表重新排列添加到 WordPress 后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆