Support » Plugin: OptionTree » List Item ID problem

  • Hi!
    Firstly thanks four your great job. Option tree makes custom admin area development faster and lighter.
    And apologize if this topic already exists. I have been looking for the solution but I didn’t find it.

    I’m using it in theme folder and I had some problems with list items. All of them have a limited number for me. I can add 3 o 4 in each section but when I try to add more it repeats last ID item and overwrite it. (it use to give a big Id number)
    I’m using coustom fields for my project. I modified some fields in theme-options.php after add data in admin area. Can it be the problem? How can I solve it?
    Thanks for your help!

    This is the code of my theme-options.php (I only use general_default section i just save miscellaneous as a backup to add new items)

    <?php
    /**
     * Initialize the options before anything else.
     */
    add_action( 'admin_init', '_custom_theme_options', 1 );
    
    /**
     * Theme Mode demo code of all the available option types.
     *
     * @return    void
     *
     * @access    private
     * @since     2.0
     */
    function _custom_theme_options() {
    
      /**
       * Get a copy of the saved settings array.
       */
      $saved_settings = get_option( 'option_tree_settings', array() );
    
      /**
       * Create a custom settings array that we pass to
       * the OptionTree Settings API Class.
       */
      $custom_settings = array(
        'contextual_help' => array(
          'content'       => array(
            array(
              'id'        => 'general_help',
              'title'     => 'Carta',
              'content'   => '<p>Help content goes here!</p>'
            )
          ),
          'sidebar'       => '<p>Sidebar content goes here!</p>'
        ),
        'sections'        => array(
          array(
            'title'       => 'Carta',
            'id'          => 'general_default'
          ),
          array(
            'title'       => 'Miscellaneous ',
            'id'          => 'miscellaneous'
          )
        ),
        'settings'        => array(
    
    	  /*TWO ITS*/
    	  array(
            'label'       => 'TWO ITS',
            'id'          => 'type01_title',
            'type'        => 'textblock-titled',
            'desc'        => '',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Nom de secció',
                'id'          => 'type01_nom',
                'type'        => 'text',
                'desc'        => 'Nom curt de la secció.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Descipció general',
                'id'          => 'type01_descr01',
                'type'        => 'text',
                'desc'        => 'Descipció o anotació breu.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Apunt',
                'id'          => 'type01_descr02',
                'type'        => 'text',
                'desc'        => 'Descripcio o anotacions secundaria.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
          array(
            'label'       => 'Elements de la secció',
            'id'          => 'type01',
            'type'        => 'list-item',
            'desc'        => 'Apretar "Add New" per afegir un nou element.<br/>Guardar sempre amb "save changes" un cop fets els canvis.',
            'settings'    => array(
    		   array(
                'label'       => 'Preu',
                'id'          => 'carta_preu',
                'type'        => 'text',
                'desc'        => 'Preu del producte en euros.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
    		  array(
                'label'       => 'Unitats',
                'id'          => 'carta_unitats',
                'type'        => 'text',
                'desc'        => 'Unitats incloses en el producte.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Descripció',
                'id'          => 'carta_descr',
                'type'        => 'textarea-simple',
                'desc'        => 'Descipció del producte (max 3 línies)',
                'std'         => '',
                'rows'        => '6',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Imatge 1',
                'id'          => 'carta_img1',
                'type'        => 'upload',
                'desc'        => 'Imatge principal del producte',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
    		  array(
                'label'       => 'Imatge 2',
                'id'          => 'carta_img2',
                'type'        => 'upload',
                'desc'        => 'Il•lustració secundaria del producte(opcional)',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    /*/TWO ITS*/
    
    /*ITS*/
    	  array(
            'label'       => 'ITS',
            'id'          => 'type02_title',
            'type'        => 'textblock-titled',
            'desc'        => '',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Nom de secció',
                'id'          => 'type02_nom',
                'type'        => 'text',
                'desc'        => 'Nom curt de la secció.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Descipció general',
                'id'          => 'type02_descr01',
                'type'        => 'text',
                'desc'        => 'Descipció o anotació breu.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Apunt',
                'id'          => 'type02_descr02',
                'type'        => 'text',
                'desc'        => 'Descripcio o anotacions secundaria.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
          array(
            'label'       => 'Elements de la secció',
            'id'          => 'type02',
            'type'        => 'list-item',
            'desc'        => 'Apretar "Add New" per afegir un nou element.<br/>Guardar sempre amb "save changes" un cop fets els canvis.',
            'settings'    => array(
    		   array(
                'label'       => 'Preu',
                'id'          => 'carta_preu',
                'type'        => 'text',
                'desc'        => 'Preu del producte en euros.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
    		  array(
                'label'       => 'Unitats',
                'id'          => 'carta_unitats',
                'type'        => 'text',
                'desc'        => 'Unitats incloses en el producte.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Descripció',
                'id'          => 'carta_descr',
                'type'        => 'textarea-simple',
                'desc'        => 'Descipció del producte (max 3 línies)',
                'std'         => '',
                'rows'        => '6',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Imatge 1',
                'id'          => 'carta_img1',
                'type'        => 'upload',
                'desc'        => 'Imatge principal del producte',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    /*/ITS*/
    
    /*ROLLS*/
    	  array(
            'label'       => 'ROLLS',
            'id'          => 'type03_title',
            'type'        => 'textblock-titled',
            'desc'        => '',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Nom de secció',
                'id'          => 'type03_nom',
                'type'        => 'text',
                'desc'        => 'Nom curt de la secció.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Descipció general',
                'id'          => 'type03_descr01',
                'type'        => 'text',
                'desc'        => 'Descipció o anotació breu.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Apunt',
                'id'          => 'type03_descr02',
                'type'        => 'text',
                'desc'        => 'Descripcio o anotacions secundaria.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
          array(
            'label'       => 'Elements de la secció',
            'id'          => 'type03',
            'type'        => 'list-item',
            'desc'        => 'Apretar "Add New" per afegir un nou element.<br/>Guardar sempre amb "save changes" un cop fets els canvis.',
            'settings'    => array(
    		   array(
                'label'       => 'Preu',
                'id'          => 'carta_preu',
                'type'        => 'text',
                'desc'        => 'Preu del producte en euros.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
    		  array(
                'label'       => 'Unitats',
                'id'          => 'carta_unitats',
                'type'        => 'text',
                'desc'        => 'Unitats incloses en el producte.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Descripció',
                'id'          => 'carta_descr',
                'type'        => 'textarea-simple',
                'desc'        => 'Descipció del producte (max 3 línies)',
                'std'         => '',
                'rows'        => '6',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Imatge 1',
                'id'          => 'carta_img1',
                'type'        => 'upload',
                'desc'        => 'Imatge principal del producte',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    /*/ROLLS*/
    
    /*SALSES*/
    	  array(
            'label'       => 'SALSES',
            'id'          => 'type07_title',
            'type'        => 'textblock-titled',
            'desc'        => '',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Nom de secció',
                'id'          => 'type07_nom',
                'type'        => 'text',
                'desc'        => 'Nom curt de la secció.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Descipció general',
                'id'          => 'type07_descr01',
                'type'        => 'text',
                'desc'        => 'Descipció o anotació breu.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Apunt',
                'id'          => 'type07_descr02',
                'type'        => 'text',
                'desc'        => 'Descripcio o anotacions secundaria.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
          array(
            'label'       => 'Elements de la secció',
            'id'          => 'type07',
            'type'        => 'list-item',
            'desc'        => 'Apretar "Add New" per afegir un nou element.<br/>Guardar sempre amb "save changes" un cop fets els canvis.',
            'settings'    => array(
    		   array(
                'label'       => 'Preu',
                'id'          => 'carta_preu',
                'type'        => 'text',
                'desc'        => 'Preu del producte en euros.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Descripció',
                'id'          => 'carta_descr',
                'type'        => 'textarea-simple',
                'desc'        => 'Descipció del producte (max 3 línies)',
                'std'         => '',
                'rows'        => '6',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Imatge 1',
                'id'          => 'carta_img1',
                'type'        => 'upload',
                'desc'        => 'Imatge principal del producte',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    /*/SALSES*/
    
    /*POSTRES*/
    	  array(
            'label'       => 'POSTRES',
            'id'          => 'type05_title',
            'type'        => 'textblock-titled',
            'desc'        => '',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Nom de secció',
                'id'          => 'type05_nom',
                'type'        => 'text',
                'desc'        => 'Nom curt de la secció.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Descipció general',
                'id'          => 'type05_descr01',
                'type'        => 'text',
                'desc'        => 'Descipció o anotació breu.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Apunt',
                'id'          => 'type05_descr02',
                'type'        => 'text',
                'desc'        => 'Descripcio o anotacions secundaria.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
          array(
            'label'       => 'Elements de la secció',
            'id'          => 'type05',
            'type'        => 'list-item',
            'desc'        => 'Apretar "Add New" per afegir un nou element.<br/>Guardar sempre amb "save changes" un cop fets els canvis.',
            'settings'    => array(
              array(
                'label'       => 'Descripció',
                'id'          => 'carta_descr',
                'type'        => 'textarea-simple',
                'desc'        => 'Descipció del producte (max 3 línies)',
                'std'         => '',
                'rows'        => '6',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Imatge 1',
                'id'          => 'carta_img1',
                'type'        => 'upload',
                'desc'        => 'Imatge principal del producte',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    /*/POSTRES*/
    /*COMPLEMENTS*/
    	  array(
            'label'       => 'COMPLEMENTS',
            'id'          => 'type06_title',
            'type'        => 'textblock-titled',
            'desc'        => '',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Nom de secció',
                'id'          => 'type06_nom',
                'type'        => 'text',
                'desc'        => 'Nom curt de la secció.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Descipció general',
                'id'          => 'type06_descr01',
                'type'        => 'text',
                'desc'        => 'Descipció o anotació breu.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
    	  array(
                'label'       => 'Apunt',
                'id'          => 'type06_descr02',
                'type'        => 'text',
                'desc'        => 'Descripcio o anotacions secundaria.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => '',
    			'section'     => 'general_default'
          ),
          array(
            'label'       => 'Elements de la secció',
            'id'          => 'type06',
            'type'        => 'list-item',
            'desc'        => 'Apretar "Add New" per afegir un nou element.<br/>Guardar sempre amb "save changes" un cop fets els canvis.',
            'settings'    => array(
    		   array(
                'label'       => 'Preu',
                'id'          => 'carta_preu',
                'type'        => 'text',
                'desc'        => 'Preu del producte en euros.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
    		  array(
                'label'       => 'Unitats',
                'id'          => 'carta_unitats',
                'type'        => 'text',
                'desc'        => 'Unitats incloses en el producte.',
                'std'         => '',
                'rows'        => '1',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Descripció',
                'id'          => 'carta_descr',
                'type'        => 'textarea-simple',
                'desc'        => 'Descipció del producte (max 3 línies)',
                'std'         => '',
                'rows'        => '6',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Imatge 1',
                'id'          => 'carta_img1',
                'type'        => 'upload',
                'desc'        => 'Imatge principal del producte',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
    		  array(
                'label'       => 'Imatge 2',
                'id'          => 'carta_img2',
                'type'        => 'upload',
                'desc'        => 'Il•lustració secundaria del producte(opcional)',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'general_default'
          ),
    /*/COMPLEMENTS*/
          array(
            'label'       => 'Background',
            'id'          => 'my_background',
            'type'        => 'background',
            'desc'        => 'BlahLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
    
          array(
            'label'       => 'Category Checkbox',
            'id'          => 'my_category_checkbox',
            'type'        => 'category-checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Category Select',
            'id'          => 'my_category_select',
            'type'        => 'category-select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Checkbox',
            'id'          => 'my_checkbox',
            'type'        => 'checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'choices'     => array(
              array (
                'label'       => 'Yes',
                'value'       => 'Yes'
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Colorpicker',
            'id'          => 'my_colorpicker',
            'type'        => 'colorpicker',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'CSS',
            'id'          => 'my_css',
            'type'        => 'css',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '20',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Custom Post Type Checkbox',
            'id'          => 'my_custom_post_type_checkbox',
            'type'        => 'custom-post-type-checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => 'post',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Custom Post Type Select',
            'id'          => 'my_custom_post_type_select',
            'type'        => 'custom-post-type-select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => 'post',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'List Item',
            'id'          => 'my_list_item',
            'type'        => 'list-item',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'settings'    => array(
              array(
                'label'       => 'Upload',
                'id'          => 'my_list_item_upload',
                'type'        => 'upload',
                'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Text',
                'id'          => 'my_list_item_text',
                'type'        => 'text',
                'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
                'std'         => '',
                'rows'        => '',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              ),
              array(
                'label'       => 'Textarea Simple',
                'id'          => 'my_list_item_textarea_simple',
                'type'        => 'textarea-simple',
                'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
                'std'         => '',
                'rows'        => '10',
                'post_type'   => '',
                'taxonomy'    => '',
                'class'       => ''
              )
            ),
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Measurement',
            'id'          => 'my_measurement',
            'type'        => 'measurement',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Page Checkbox',
            'id'          => 'my_page_checkbox',
            'type'        => 'page-checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Page Select',
            'id'          => 'my_page_select',
            'type'        => 'page-select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Post Checkbox',
            'id'          => 'my_post_checkbox',
            'type'        => 'post-checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Post Select',
            'id'          => 'my_post_select',
            'type'        => 'post-select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Radio',
            'id'          => 'my_radio',
            'type'        => 'radio',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'choices'     => array(
              array(
                'label'       => 'Yes',
                'value'       => 'yes'
              ),
              array(
                'label'       => 'No',
                'value'       => 'no'
              ),
              array(
                'label'       => 'Maybe',
                'value'       => 'maybe'
              )
            ),
            'std'         => 'yes',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Radio Image',
            'id'          => 'my_radio_image',
            'type'        => 'radio-image',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => 'right-sidebar',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Select',
            'id'          => 'my_select',
            'type'        => 'select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'choices'     => array(
              array(
                'label'       => 'Yes',
                'value'       => 'yes'
              ),
              array(
                'label'       => 'No',
                'value'       => 'no'
              ),
              array(
                'label'       => 'Maybe',
                'value'       => 'maybe'
              )
            ),
            'std'         => 'maybe',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Tag Checkbox',
            'id'          => 'my_tag_checkbox',
            'type'        => 'tag-checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Tag Select',
            'id'          => 'my_tag_select',
            'type'        => 'tag-select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Taxonomy Checkbox',
            'id'          => 'my_taxonomy_checkbox',
            'type'        => 'taxonomy-checkbox',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => 'category,post_tag',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Taxonomy Select',
            'id'          => 'my_taxonomy_select',
            'type'        => 'taxonomy-select',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => 'category,post_tag',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Text',
            'id'          => 'my_text',
            'type'        => 'text',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Textarea',
            'id'          => 'my_textarea',
            'type'        => 'textarea',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '15',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Textarea Simple',
            'id'          => 'my_textarea_simple',
            'type'        => 'textarea-simple',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '10',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Textblock',
            'id'          => 'my_textblock',
            'type'        => 'textblock',
            'desc'        => '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Textblock Titled',
            'id'          => 'my_textblock_titled',
            'type'        => 'textblock-titled',
            'desc'        => '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Typography',
            'id'          => 'my_typography',
            'type'        => 'typography',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          ),
          array(
            'label'       => 'Upload',
            'id'          => 'my_upload',
            'type'        => 'upload',
            'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'std'         => '',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'class'       => '',
            'section'     => 'miscellaneous'
          )
        )
      );
    
      /* allow settings to be filtered before saving */
      $custom_settings = apply_filters( 'option_tree_settings_args', $custom_settings );
    
      /* settings are not the same update the DB */
      if ( $saved_settings !== $custom_settings ) {
        update_option( 'option_tree_settings', $custom_settings );
      }
    
    }

    this is the code I inserted in functions.php:

    /*option tree__________________________________________________*/
    
    /**
     * Theme Options
     */
    include_once( 'includes/theme-options.php' );
    
    /**
     * Optional: set 'ot_show_pages' filter to false.
     * This will hide the settings & documentation pages.
     */
    add_filter( 'ot_show_pages', '__return_false' );
    
    /**
     * Optional: set 'ot_show_new_layout' filter to false.
     * This will hide the "New Layout" section on the Theme Options page.
     */
    add_filter( 'ot_show_new_layout', '__return_false' );
    
    /**
     * Required: set 'ot_theme_mode' filter to true.
     */
    add_filter( 'ot_theme_mode', '__return_true' );
    
    /**
     * Required: include OptionTree.
     */
    include_once( 'option-tree/ot-loader.php' );
    
    /*/option tree__________________________________________________*/

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

Viewing 1 replies (of 1 total)
  • Hi!! I solved part of the problem.
    The overwriting ID problem is caused by my comments inside the arrays. I removed all comments like /*XXXXXX*/ (big mistake by my side) overwriting is solved.

    But now when I add a new list-item inside my list-item (type) the ID is something like:
    Item 1
    Item 12
    Item 113
    Item 1114

    Item 111111119
    Item 1111111120
    Item 11111111121
    Item 111111111122

    Item 1.11111111111E+21

    If I add more than one list object is the same thing but change the number like: Item 1, Item 22, Item 223…

    I realized this only happens when use a list object with ID name modified, the default list object works perfectly, but I need mode than one list objects in my project, so I have to rename them.

    There is some proper way to do it and avoid this problem?

    Thank you for your help!

Viewing 1 replies (of 1 total)
  • The topic ‘List Item ID problem’ is closed to new replies.