Title: [Plugin: OptionTree] How to reference list items?
Last modified: August 20, 2016

---

# [Plugin: OptionTree] How to reference list items?

 *  Resolved [nlsubtitles](https://wordpress.org/support/users/nlsubtitles/)
 * (@nlsubtitles)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/)
 * Hi,
 * There is probably a pretty simple answer to this question but I can’t seem to
   find it anywhere.
 * When list items are created, how do you echo those in the theme?
    Every list 
   item setting has an ID, but when multiple items are added to the list, what is
   the ID of the second one, third one and so on..?
 * And is there a way to put a maximum to a list? So that no more than 3 items can
   be added.
 * Thanks!!
 * [http://wordpress.org/extend/plugins/option-tree/](http://wordpress.org/extend/plugins/option-tree/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [nlsubtitles](https://wordpress.org/support/users/nlsubtitles/)
 * (@nlsubtitles)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912364)
 * found the solution myself:)
 *  [Danilux](https://wordpress.org/support/users/danilux/)
 * (@danilux)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912377)
 * I need a way to reference list items, can’t seem to be able to get the values.
   For slider is pretty simple like $proyect_images[‘image’]; but can’t get to the
   correct array when using list items.
 *  Plugin Author [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * (@valendesigns)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912389)
 * [@danilux](https://wordpress.org/support/users/danilux/) You need to do a print_r()
   on the list item array and see what the keys are so you can echo things out properly.
 *  Thread Starter [nlsubtitles](https://wordpress.org/support/users/nlsubtitles/)
 * (@nlsubtitles)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912436)
 * Yes I did it the same way.
    It should be something like
 *     ```
       echo slider[0][the_id]
       echo slider[1][the_id]
       ```
   
 * and so on..
 *  [vabmedia](https://wordpress.org/support/users/vabmedia/)
 * (@vabmedia)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912490)
 * How did you output your images? I’m having trouble outputting images from a list
   item meta box.
 *  Plugin Author [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * (@valendesigns)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912491)
 * [@vabmedia](https://wordpress.org/support/users/vabmedia/) print_r() the array
   and take note of your array keys. Once you know what the keys are you would do
   a foreach loop and echo the HTML you need to display your images.
 * The following code would echo the images if the key was “src” and the setting
   ID was “images”
 *     ```
       if ( function_exists( 'ot_get_option' ) ) {
   
         /* get the images array */
         $images = ot_get_option( 'images', array() );
   
         if ( ! empty( $images ) ) {
           foreach( $images as $image ) {
             echo '<img src="' . $image['src'] . '" alt="' . $image['title'] . '" />';
           }
         }
   
       }
       ```
   
 *  [vexdex](https://wordpress.org/support/users/vexdex/)
 * (@vexdex)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912511)
 * Hi, Derek. Thanks for your beautiful plugin. But, I have problem with insert 
   next level list-item in list-item. I need to include list slides in list sliders.
   Does it possible with your plugin ?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: OptionTree] How to reference list items?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/option-tree_363534.svg)
 * [OptionTree](https://wordpress.org/plugins/option-tree/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/option-tree/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/option-tree/)
 * [Active Topics](https://wordpress.org/support/plugin/option-tree/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/option-tree/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/option-tree/reviews/)

 * 7 replies
 * 5 participants
 * Last reply from: [vexdex](https://wordpress.org/support/users/vexdex/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/plugin-optiontree-how-to-reference-list-items/#post-2912511)
 * Status: resolved