dongtan5558 2014-08-26 13:24
浏览 45
已采纳

Wordpress可重复的metabox组

what code spinet i use in page.php to show data in frontend.

array(
'id'          => $prefix . 'repeat_group',
'type'        => 'group',
'description' => __( 'Generates reusable form entries', 'cmb' ),
'options'     => array(
    'group_title'   => __( 'Entry {#}', 'cmb' ), // since version 1.1.4, {#} gets replaced by row number
    'add_button'    => __( 'Add Another Entry', 'cmb' ),
    'remove_button' => __( 'Remove Entry', 'cmb' ),
    'sortable'      => true, // beta
),
// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
'fields'      => array(
    array(
        'name' => 'Entry Title',
        'id'   => 'title',
        'type' => 'text',
        // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
    ),
    array(
        'name' => 'Description',
        'description' => 'Write a short description for this entry',
        'id'   => 'description',
        'type' => 'textarea_small',
    ),
    array(
        'name' => 'Entry Image',
        'id'   => 'image',
        'type' => 'file',
    ),
    array(
        'name' => 'Image Caption',
        'id'   => 'image_caption',
        'type' => 'text',
    ),
),

),

above code taken from:

https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#group

I did not find any way how i can put it in page.php and show data in front end page.

Thank for help

  • 写回答

2条回答 默认 最新

  • drxm5014 2014-08-26 13:29
    关注

    I think the easiest way to have repeatable metaboxes in the WordPress admin, is to use ACF (http://www.advancedcustomfields.com/) with the repeater field (http://www.advancedcustomfields.com/add-ons/repeater-field/)

    it gives a really nice end product, its easy to use/implement, it has good support, and can be bundled with any theme/plugin as long as you follow the instructions for doing so.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来