Issue getting group to save/load on front end

Support MB Group Issue getting group to save/load on front end

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3224
    jonwatson87jonwatson87
    Participant

    Okay, two issues with my groups. Firstly, I can't save more than 1 set of records. Every time I "Add more" the first record is replaced and none of the others save.

    Secondly, it doesn't want to display properly on the front end. I want it to display conditionally, if there are records.

    What have I messed up?

    //Panelists
    
    	$meta_boxes[] = array(
    			'title'      => 'Panelists',
    			'context'    => 'normal',
    			'priority'   => 'high',
    			'post_types' => 'events',
    			'desc'       => '(drag to reorder)',
    			'fields' 	 => array(
    				array(
    						'id'         => 'radix_panelists',
    						'type'       => 'group',
    						'clone'      => true,
    						'sort_clone' => true,
    						'fields'     => array(
    							array(
    									'name'  => 'Name',
    									'id'    => $prefix . 'panelistname',
    									'type'  => 'text',
    									'desc'  => 'Name of panelist',
    							),
    							array(
    									'name'  => 'URL',
    									'id'    => $prefix . 'panelisturl',
    									'type'  => 'text',
    									'desc'  => 'Link or mailto: for panelist',
    							),
    							array(
    									'name'  => 'Profile Pic',
    									'id'    => $prefix . 'panelistpic',
    									'type'  => 'file_input',
    									'desc'  => 'Profile picture of panelist',
    							),
    					),
    				),
    			),
    	);
    
        return $meta_boxes;

    And then on the page template:

    	// Speakers
    
    	$speakergroup = rwmb_meta( 'radix_panelists' );
    
    	if ( ! empty( $speakergroup ) ) {
    
    		echo '<div class="eventspeakers">';
    
    		echo '<h1>Speakers</h1>';
    
    		// Call Panelist Data
    
    		foreach ( $speakergroup as $speakerdata ) {
    					echo '<div class="eventspeaker">';
    
    if ( ! empty ($speakerdata['radix_panelistpic'])) {
    			$attachment_id = attachment_url_to_postid( $speakerdata['radix_panelistpic'] );
      	list( $src ) = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
      	echo '<a href="' . $speakerdata['radix_panelisturl'] . '" target=_blank><img src="' . $src . '"></a>';
    			} else {
    echo '<a href="' . $speakerdata['radix_panelisturl'] . '" target=_blank><img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/default-profile.jpg"></a>';
    
    	
    }
    			echo '<div class="speakername"><a href="' . $speakerdata['radix_panelisturl'] . '" target=_blank>' . $speakerdata['radix_panelistname'] . '</a></div>';
    
    			echo '</div>';
    
    		}
    
    		echo '</div>';
    
    	}
    
    	else {
    
    	}
    #3225
    jonwatson87jonwatson87
    Participant

    Okay, loading fine on the front end now! Must've mis-copied/pasted something.

    Still not letting me add more than 1 group record, however...

    #3242
    Anh TranAnh Tran
    Keymaster

    Hi @jonwatson87, can you please refresh your browser to clear the cache? Someone asked me the same question and the problem was the JavaScript cache.

    #3254
    jonwatson87jonwatson87
    Participant

    100% correct! Sorry, Anh! Feel like an idiot now! Clearing the cache is usually the first thing I do! XD

    Thanks so much for the help!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Issue getting group to save/load on front end’ is closed to new replies.