Forum Replies Created
-
AuthorPosts
-
November 21, 2015 at 5:58 AM in reply to: if ( ! empty ) returning blank fields rather than else content #1792
jonwatson87
ParticipantMeta Box 4.7
MB Group 1.0.2function 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' );November 19, 2015 at 8:03 AM in reply to: if ( ! empty ) returning blank fields rather than else content #1763jonwatson87
ParticipantJust 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>'; }jonwatson87
ParticipantAwesome! Just what I was looking for! You're a star! ๐
November 13, 2015 at 3:31 AM in reply to: Is it possible to combine two meta items and concatenate them into a third? #1727jonwatson87
ParticipantThanks, 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! ๐
-
AuthorPosts