Title: Show group
Last modified: August 30, 2016

---

# Show group

 *  Resolved [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/)
 *     ```
       $entries = get_post_meta( get_the_ID(), 'gg_elementos', true );
       foreach ( (array) $entries as $key => $entry ) {
           $title = $desc = '';
           if ( isset( $entry['gg_titulo'] ) )
               $title = esc_html( $entry['gg_titulo'] );
           if ( isset( $entry['gg_textmoney'] ) )
               $desc = esc_html( $entry['gg_textmoney'] );
       }
       echo $title;
       ```
   
 * Why don’t show anything?
 * [https://wordpress.org/plugins/cmb2/](https://wordpress.org/plugins/cmb2/)

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/show-group-1/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/show-group-1/page/2/?output_format=md)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605125)
 * One thing to keep in mind is that those variables are getting overwritten in 
   each iteration of your foreach loop. It’s possible both values in the if statements
   are empty on the last iteration, causin you to have the empty $title variable.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605201)
 * You were right, thanks.
    A further problem. When I selected a date returns this
   error:
 *     ```
       Notice: Array to string conversion in \wordpress\wp-content\themes\theme\metabox\includes\CMB2_Utils.php on line 131
   
       Notice: Array to string conversion in \wordpress\wp-content\themes\theme\metabox\includes\CMB2_Utils.php on line 120
       ```
   
 * But when I remove the option: `'repeatable' => true` simply is not saved.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605221)
 * Could you provide the settings you’re using for this field? Curious about that
   Array to string issues.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605226)
 *     ```
       require_once dirname( __FILE__ ) . '/metabox/init.php';
   
       add_action( 'cmb2_init', 'factura' );
       function factura() {
       	$prefix = 'gg_';
   
       	$cmb_group = new_cmb2_box( array(
       		'id'           => $prefix . 'factura',
       		'title'        => __( 'Servicios' ),
       		'object_types' => array( 'factura' )
       	) );
   
       	$group_field_id = $cmb_group->add_field( array(
       		'id'          => $prefix . 'demo',
       		'type'        => 'group',
       		'options'     => array(
       			'group_title'   => __( 'Elemento {#}' ),
       			'add_button'    => __( 'Añadir elemento' ),
       			'remove_button' => __( 'Eliminar elemnto' ),
       			'sortable'      => true
       		)
       	) );
   
       	$cmb_group->add_group_field( $group_field_id, array(
       		'name'       => __( 'Descripción' ),
       		'id'         => $prefix . 'titulo',
       		'type'       => 'text'
       	) );
       	$cmb_group->add_group_field( $group_field_id, array(
       		'name' => __( 'Fecha' ),
       		'id'   => $prefix . 'textdate',
       		'type' => 'text_date_timestamp',
               'repeatable' => true
       	) );
       	$cmb_group->add_group_field( $group_field_id, array(
       		'name' => __( 'Precio' ),
       		'id'   => $prefix . 'textmoney',
       		'type' => 'text_money',
       		'after_field' => '€',
       		'before_field' => ' ',
       	) );
       }
       ```
   
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605243)
 * Are you updated to the latest version of the plugin? Where/when are you seeing
   those errors appear?
 * I just tried on a dev site and things saved fine from what I can see.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605246)
 * No, I have version 2.1.0. It appears above the METABOX. A date appears when you
   save, if not to date shown no error.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605247)
 * With 2.1.2
 *     ```
       Notice: Array to string conversion in \wordpress\wp-content\plugins\cmb2\includes\CMB2_Utils.php on line 152
   
       Notice: Array to string conversion in \wordpress\wp-content\plugins\cmb2\includes\CMB2_Utils.php on line 141
       ```
   
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605251)
 * Not managing to reproduce on my own install, sadly.
 * The two lines referenced above come from in the following:
 *     ```
       /**
        * Returns a timestamp, first checking if value already is a timestamp.
        * @since  2.0.0
        * @param  string|int $string Possible timestamp string
        * @return int   	            Time stamp
        */
       public function make_valid_time_stamp( $string ) {
       	if ( ! $string ) {
       		return 0;
       	}
   
       	return $this->is_valid_time_stamp( $string )
       		? (int) $string :
       		strtotime( (string) $string );
       }
   
       /**
        * Determine if a value is a valid timestamp
        * @since  2.0.0
        * @param  mixed  $timestamp Value to check
        * @return boolean           Whether value is a valid timestamp
        */
       public function is_valid_time_stamp( $timestamp ) {
       	return (string) (int) $timestamp === (string) $timestamp
       		&& $timestamp <= PHP_INT_MAX
       		&& $timestamp >= ~PHP_INT_MAX;
       }
       ```
   
 * Line 141 is “strtotime( (string) $string );” and line 152 is: “&& $timestamp 
   <= PHP_INT_MAX”.
 * Not sure why it’s getting an array passed in.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605254)
 * If you use the option to repeat, it returns the error. And if you do not use,
   it is saved when he wants.
 * I tried on another website and still going the same, with a new theme.
 * Want to make a video demo? With mail…
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605260)
 * Sure, if you want to. I’ve been copying what you’ve provided exactly, except 
   for the object type, and just not seeing the error.
 * As a thought, I’m curious if you’ve somehow got old data for the keys saved, 
   and that’s what’s getting fetched. Have you tried other CMB2 fields using the
   same key, with this test post you’re using? Or is this happening on a brand new
   published post?
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605271)
 * I’ve been testing and I have not discovered the error. Finally I decided to use
   jQuery Datapicker. Its works.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605273)
 * At this point, do what ya gotta do for a working solution. Wish I knew what was
   going on with it though, in case it was a bug coming from the plugin itself.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605323)
 * I found the error. Only it appears if you use “dd / mm / yy”. The error occurs
   when you choose dates where the day is over 12.
    Example: 6/10/15 choose, beware.
   8/13/15 choose, is not saved.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605324)
 * Odd, but at the same time if you’re using that format, then the 13 would be the
   month, not the day, as well.
 *  Thread Starter [seravifer](https://wordpress.org/support/users/seravifer/)
 * (@seravifer)
 * [11 years ago](https://wordpress.org/support/topic/show-group-1/#post-6605325)
 * oh, sorry, yes.
    When i choose 13/08/15, is not saved.

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/show-group-1/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/show-group-1/page/2/?output_format=md)

 The topic ‘Show group’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 19 replies
 * 2 participants
 * Last reply from: [seravifer](https://wordpress.org/support/users/seravifer/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/show-group-1/page/2/#post-6605353)
 * Status: resolved