Forum Replies Created
-
AuthorPosts
-
vagelisMemberThanx you Steve! Rookie mistake. It’s working now. And thank you for your advice. I’ll surely follow it. Another thing happening, is that instead of ‘Publish’ on the right, it says ‘Save’ and after pressing it the post gets published as Draft. How can I change that to show publish(as any other post type) and get publish status instead of draft?
Attachments:
You must be logged in to view attached files.
vagelisMemberThank you for the quick reply and sorry for not posting these before.
This is my post type snippet:
function boats_post_types($post_types) { $post_types['boats'] = array( 'labels' => piklist('post_type_labels', 'Boats') ,'title' => __('Add a new Boat') ,'supports' => array( 'title', 'revisions', ) ,'public' => true ,'taxonomies' => array('category') ,'has_archive' => true ,'rewrite' => array( 'slug' => 'boat' ) ,'edit_columns' => array( 'title' => __('Boat') ,'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 ), 'published' => array( 'label' => 'Published', 'public' => true ) ) ); return $post_types; } add_filter('piklist_post_types', 'boats_post_types'); function boats_rewrite_flush() { // codex_boats_init(); boats_post_types(); flush_rewrite_rules(); } register_activation_hook( __FILE__, 'boats_rewrite_flush' );and my metabox snippet:
<?php /* Title: Test Description: Test metabox Post Type: boats Context: normal Priority: high Locked: false Collapse: true */ piklist('field', array( 'type' => 'text' ,'field' => 'field_name' ,'label' => 'Sellers Name' ,'description' => 'Put sellers name here.' ,'attributes' => array( 'class' => 'text' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'field_name' ,'label' => 'Phone' ,'description' => 'Put sellers phone here.' ,'attributes' => array( 'class' => 'text' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'field_name' ,'label' => 'Mobile phone' ,'description' => 'Put sellers mobile phone here.' ,'attributes' => array( 'class' => 'text' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'field_name' ,'label' => 'Email' ,'description' => 'Put sellers email here.' ,'attributes' => array( 'class' => 'text' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'field_name' ,'label' => 'Address' ,'description' => 'Put sellers address here.' ,'attributes' => array( 'class' => 'text' ) )); piklist('field', array( 'type' => 'text' ,'field' => 'field_name' ,'label' => 'Boat name' ,'description' => "Put boat's name here." ,'attributes' => array( 'class' => 'text' ) ));
vagelisMemberThank you for your help Steve. Worked like a charm!
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' ) ));
vagelisMemberIs there a way to do that without messing with the plugin?
vagelisMemberI’ve made a plugin that creates workflows and so I have two tabs on the Edit Post page(Basic and SEO). Just mentioning this in case it matters.
vagelisMemberBoth ways. None of them worked
-
AuthorPosts