PHP:Metabox在前端不令人失望

时间:2019-06-14 07:46:02

标签: php meta-boxes

我正在使用自定义字段创建一个metabox,这是我尝试的代码,但是前端没有显示任何字段。我没有走错路,谁能向我指出正确的方向。提前致意

function jobs( $meta_boxes ) {
// $prefix = '';

$meta_boxes[] = array(
    'id' => 'jobs',
    'title' => esc_html__( 'Jobs', 'metabox' ),
    'post_types' => array('post' ),
    'context' => 'normal',
    'priority' => 'default',
    'autosave' => 'false',
);

return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'jobs' );


function job( $meta_boxes ) {
// $prefix = '';

$meta_boxes[] = array(
    'id' => 'jobs',
    'title' => esc_html__( 'Job', 'metabox' ),
    'post_types' => array('post' ),
    'context' => 'normal',
    'priority' => 'default',
    'autosave' => 'false',
    'fields' => array(
        array(
            'id' => $prefix . 'select_1',
            'name' => esc_html__( 'Filters', 'metabox' ),
            'type' => 'select',
            'placeholder' => esc_html__( 'Select', 'metabox' ),
            'options' => array(
                'all jobs' => 'all jobs',
                'in progress jobs' => 'in progress jobs',
                'scheduled jobs' => 'scheduled jobs',
                'unscheduled jobs' => 'unscheduled jobs',
            ),
        ),
    ),
   );
     return $meta_boxes;
  }

  add_filter( 'rwmb_meta_boxes', 'job' );

0 个答案:

没有答案