Wordpress强大的原因是它的核心基础支持你去开发和定制,像themes, plugins, custom fileds, custom post types, custom content types,custom meta等。这篇文章来说一下,custom fileds–自定义字段。
wordpress post默认支持的什么模块?
用wordpress建站经常用的有pages, posts, 这些都属于 post types也就是内容类型。 以post举例,一般它支持 category(分类), tag (标签),featured imag (特色图片),editor (文本编辑器),author (作者),date(日期)等,下图。那如果我们要添加一些额外的展示内容怎么办? 这个时候就需要custom fields。

如果是gutenberg 古腾堡编辑器,需要在古腾堡编辑器preferences偏好里开启才会显示。

如果是经典编辑器需要点击screens options才会显示。

如果要展示这些定制的custom fileds自定义字段,就要用代码在模板里输出

自定义字段custom fields在定制wordpress网站里非常重要, 尤其是大型网站。
但是wordpress默认提供的custom fields数量是有限的,如果定制wordpress网站用完了怎么办?
下一篇文章来说一下wordpress开发者经常用的 custom fileds工具。