Support Forum ยป User Profile

Forum Replies Created

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • in reply to: if ( ! empty ) returning blank fields rather than else content #1792
    jonwatson87jonwatson87
    Participant

    Meta Box 4.7
    MB Group 1.0.2

    function cf_events_register_meta_boxes( $meta_boxes )
    
    {
        $prefix = 'cf_';
    
    //Coverage
    
    	$meta_boxes[] = array(
    			'title'      => 'Event Coverage',
    			'post_types' => 'events',
    			'context'    => 'normal',
    			'priority'   => 'low',
    			'desc'       => '(drag to reorder)',
    			'fields' 	 => array(
    					array(
    						    'id'         => 'cf_coverage',
    						    'type'       => 'group',
    						    'clone'      => true,
    						    'sort_clone' => true,
    						    'fields'     => array(
    						array(
    							'name'  => 'Title',
    							'id'    => $prefix . 'coveragedesc',
    							'type'  => 'text',
    							'desc'  => 'Title or description for link',
    						),
    						array(
    							'name'  => 'URL',
    							'id'    => $prefix . 'coverageurl',
    							'type'  => 'text',
    							'desc'  => 'Link to coverage',
    						),
    						array(
    							'name'  => 'Date',
    							'id'    => $prefix . 'coveragedate',
    							'type'  => 'date',
    							'desc'  => 'Date of event coverage',
    						),
    						),
    					),
    			),
    	);
     
    
        return $meta_boxes;
    
    }
    
    add_filter( 'rwmb_meta_boxes', 'cf_events_register_meta_boxes' );
    in reply to: if ( ! empty ) returning blank fields rather than else content #1763
    jonwatson87jonwatson87
    Participant

    Just noticed I had that UL in the wrong place, but still having the same problem:

    	// Event Coverage
    
    	$coveragegroup = rwmb_meta( 'cf_coverage' );
    
    	if ( ! empty( $coveragegroup ) ) {
    
    		echo '<div class="eventcoverage">';
    
    		echo '<div class="coverage">';
    
    		echo '<ul>';
    
    		// Call Coverage Data
    
    		foreach ( $coveragegroup as $coveragedata ) {
    
    			echo '<li>';
    			echo '<a href="' . $coveragedata['cf_coverageurl'] . '" target=_blank>' . $coveragedata['cf_coveragedesc'] . '</a><br>';
    			
    			// Coverage Date
    
    			$thecoveragedate = $coveragedata['cf_coveragedate'];
    
    			if ( ! empty( $thecoveragedate ) ) {
    			$thecoveragedate = $coveragedata['cf_coveragedate'];
    			$getcoveragedate = date( 'jS F Y', strtotime($thecoveragedate) );
    			echo '<div class="coveragedate">';
    			echo $getcoveragedate;
    			echo '</div>';
    			}
    			echo '</li>';
    
    		}
    
    		echo '</ul>';
    		echo '</div></div>';
    
    	}
    
    	else {
    
    		echo '<p>No coverage found</p>';
    
    	}
    in reply to: Retrieving thumbnail images #1734
    jonwatson87jonwatson87
    Participant

    Awesome! Just what I was looking for! You're a star! ๐Ÿ™‚

    jonwatson87jonwatson87
    Participant

    Thanks, Ahn! I did have a look at doing it that way, but in the end it was quicker and easier just to go back and change all the date and time fields to combined datetime ones!

    Thanks for the suggestion, and for getting back to me! ๐Ÿ™‚

Viewing 4 posts - 16 through 19 (of 19 total)