我在wordpress中创建了一个自定义帖子类型, 称为视频。管理员添加视频时, 他还需要提供youtube-id。可以通过从下拉列表中选择适当的自定义字段, 然后输入ID来完成。
不过, 我想知道, 在添加或编辑视频时, 是否没有办法始终显示该自定义字段? (并且可以选择是否将其设置为必填字段?)
#1
你可以使用”更多字段”或”自定义帖子类型” UI插件为你的视频帖子创建youtube-id字段。
#2
8年后我会回答我自己的问题:)
对于居住在另一个星球上的人:只需使用ACF插件
#3
在创建自定义帖子类型草稿之前, Youtube帖子类型还需要一个YouTube网址。
#4
为YouTube视频网址创建元字段
通过使用
add_meta_box($ id, $ title, $ callback, $ post_type, $ context, $ priority, $ callback_args);
例子
来源:
https://www.srcmini02.com/63054.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_42012.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57