- This topic has 4 replies, 2 voices, and was last updated 6 years, 8 months ago by
Steve.
-
AuthorPosts
-
-
May 31, 2015 at 6:36 pm #3772
vagelisMemberI have been working on my first plugin with Piklist. I’ve created a custom post type named ‘service’, along with a meta box named ‘test’ with additional fields. I’ve checked all headers and they seem correct. Folder structure seems also correct. Plugin works correctly btw. Please advise what I’m doing wrong. I’ve attached both post-type code and meta-box code.
-
May 31, 2015 at 6:51 pm #3773
vagelisMemberPlugin Code:
<?php /* Plugin Name: Services Description: Piklist Plugin for Services Version: 0.1 Author: Vagelis Katsiotis Author URI: https://gr.linkedin.com/in/vageliskatsiotis Plugin Type: Piklist License: GPL3 */ function services_post_types($post_types) { $post_types['services'] = array( 'labels' => piklist('post_type_labels', 'Services') ,'title' => __('Add a new Service') ,'supports' => array( 'title', 'revisions', ) ,'public' => true ,'taxonomies' => array('category') ,'has_archive' => true ,'rewrite' => array( 'slug' => 'service' ) ,'edit_columns' => array( 'title' => __('Service') ,'post_states' => __('Status') ) ,'hide_meta_box' => array( 'slug' ,'author' ) ,'post_states' => true ,'status' => array( 'draft' => array( 'label' => 'Inactive' ,'public' => true ) ,'active' => array( 'label' => 'Active' ,'public' => true ) ) ); return $post_types; } add_filter('piklist_post_types', 'services_post_types');Meta-Box Code:
<?php /* Title: Test Description: Test metabox Post Type: service, post, page Context: normal Priority: high Order: none Locked: false New: true Status: all Collapse: true */ piklist('field', array( 'type' => 'colorpicker' ,'scope' => 'post_meta' // Not used for settings sections ,'field' => 'field_name' ,'label' => 'Example Field' ,'description' => 'Click in box' ,'attributes' => array( 'class' => 'text' ) )); -
May 31, 2015 at 9:19 pm #3774
SteveKeymaster@vagelis– You’re so close!
A few issues with your parameters:
1)Post Type: services, post, page: you had it set toservice(singular), but your post type is plural.
2)New: true: remove. You really only need if setting to false.
3)Status: all:allis not a valid status. You would either have to type all the statuses here, or just remove this.
4)Order: none: if you don’t want to set theorder, then just leave this out.You comment block should look like this:
/* Title: Test Description: Test metabox Post Type: services, post, page Context: normal Priority: high Locked: false Collapse: true */
Let us know if you have any other questions.
-
June 1, 2015 at 5:34 am #3778
vagelisMemberThank you for your help Steve. Worked like a charm!
-
June 1, 2015 at 6:26 am #3779
SteveKeymasterGreat. Closing ticket.
-
-
AuthorPosts
- The topic ‘Meta Box Not Showing’ is closed to new replies.