WordPress.org

Forums

OptionTree
[resolved] Meta Options - List-item type not working on custom post type (6 posts)

  1. WAXFROGDESIGN
    Member
    Posted 2 years ago #

    Hello Derek,

    I have added the following code on both standard page type and custom page type. Everything works fine on standard 'page' type but it doesn't save any of the list items on the custom page type. Every time I save, the items I have created disappear.

    $locationDirections = array(
        'id'        => 'locationDirections',
        'title'     => 'Location Directions',
        'desc'      => '',
        'pages'     => 'location',
        'context'   => 'normal',
        'priority'  => 'high',
        'fields'    => array(
    			array(
    				'label'       => 'locationDirections',
    				'id'          => 'locationUpload',
    				'type'        => 'upload',
    				'class'       => '',
    				'choices'     => array()
    			),
    			array(
    				'label'       => 'Location Transport',
    				'id'          => 'locationTransport',
    				'type'        => 'list-item',
    				'class'       => '',
    				'choices'     => array(),
    				'settings'    => array(
    				     array(
    				        'label'       => 'Transport Description',
    				        'id'          => 'locationTransportsDesc',
    				        'type'        => 'text',
    				        'desc'        => '',
    				        'std'         => '',
    				        'rows'        => '',
    				        'post_type'   => '',
    				        'taxonomy'    => ''
    				      )
    				)
    			)
        )
      );
    
      ot_register_meta_box( $locationDirections );

    http://wordpress.org/extend/plugins/option-tree/

  2. ronronmx
    Member
    Posted 2 years ago #

    I have the same problem, except I can't get the list-item to work on any page/post type. It doesn't add any of the custom fields for the list-items fields.

    Sorry I wasn't much help! I too would like to find out why and how to make this work correctly.

  3. Yojance Rabelo
    Member
    Posted 2 years ago #

    Try to change the value of 'pages'.

    Instead of having this:
    'pages' => 'your-post-type',

    Try this:
    'pages' => array( 'post', 'page' ),

  4. vabmedia
    Member
    Posted 2 years ago #

    I don't understand the 'choices' => array() part of the code. What is that supposed to do? why is it in two places in your code above? And did it work when you used array('page')?

  5. vabmedia
    Member
    Posted 2 years ago #

    Nevermind, I figured it out. I don't know about anyone else, but it seems I can't change the function name and still make this work. Like there are little details you have to keep here and there.

  6. Derek Herman
    Member
    Plugin Author

    Posted 2 years ago #

    @WAXFROGDESIGN If I remember correctly you are running a plugin that created this post type and there is a conflict between OT and that plugin, right?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • OptionTree
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.