Forum Replies Created

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • in reply to: Double Fields Piklist Metaboxes #4183
    vagelis
    Member

    Thanx 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.
    in reply to: Double Fields Piklist Metaboxes #4181
    vagelis
    Member

    Thank 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'
     )
     ));
    in reply to: Meta Box Not Showing #3778
    vagelis
    Member

    Thank you for your help Steve. Worked like a charm!

    in reply to: Meta Box Not Showing #3773
    vagelis
    Member

    Plugin 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'
    	)
    ));
    
    in reply to: Custom metabox in WP Posts #2473
    vagelis
    Member

    Is there a way to do that without messing with the plugin?

    in reply to: Custom metabox in WP Posts #2471
    vagelis
    Member

    I’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.

    in reply to: Custom metabox in WP Posts #2470
    vagelis
    Member

    Both ways. None of them worked

Viewing 7 posts - 16 through 22 (of 22 total)