The select field option is not woking
aurthurm opened this issue · 2 comments
I am creating a social network post type which is working well. But when i add the metabox fields for select box isn't working.
My code is as folows:
// social_nav Post-type Pedamuse()->register_post_type( 'social_nav', __( 'Social Navigation', 'pedamuse' ), __( 'Social Navigation', 'pedamuse' ) );
// Add a metabox to social_nav post types add_action( 'add_meta_boxes', 'pedamuse_social_nav'); function pedamuse_social_nav(){ Pedamuse()->admin->add_meta_box ('social_navigation_meta',__( 'Social Navigation Links', 'pedamuse' ), array('social_nav')); }
// Add custom post fieds to social_navigation_meta metabox add_filter( 'social_nav_custom_fields', 'social_custom_fields', 10, 2 );
function social_custom_fields ( $fields, $post_type ) { $metabox = 'social_navigation_meta';
$fields = array( array( // Resource Name 'metabox' => $metabox, 'id' => 'social_name', 'label' => __( 'Resource Name', 'pedamuse' ), 'description' => __( 'Enter Social Netwrok Name', 'pedamuse' ), 'type' => 'text', 'default' => '', 'placeholder' => '' ),
array( 'metabox' => $metabox, 'id' => 'social_link', 'label' => __( 'Social URL/ Link' , 'pedamuse' ), 'description' => __( 'What is the url / web adress that links to your social profile', 'pedamuse' ), 'type' => 'url', 'default' => '', 'placeholder' => __( '//www.fb.com/foo', 'pedamuse' ) ),
array( // not working 'id' => 'social_select_name', 'label' => __( 'Social Netwrok', 'pedamuse' ), 'type' => 'select', 'options' => array( 'facebook' => 'Facebook', 'twitter' => 'Twitter', 'linkedin' => 'LinkedIn', 'instagram' => 'Instagram', 'pinterest' => 'Pinterest' ), 'default' => 'facebook' ),
);
return $fields; }
Did i miss something?
the last array doesn't work
Oh Finaly Resolved my own error
Realised i forgot to add the metabox id