Correcting Problems With Zero Speakers or Multiple Speakers in UUA Services Widget
By
UUA Web Team
March 29, 2017, 6:16 pm EDT
We noticed a few problems with the UUA Services featured and upcoming services widgets:
global $post;
$terms = wp_get_post_terms($post->ID, 'uu_service_speaker');
$count = count($terms);
if ( $count > 0 ) {
$aNames = [];
foreach ( $terms as $term ) {
$aNames[] = $term->name;
}
echo '<span class="speaker">' . implode(", ", $aNames) . "</span>";
}
?> <time class="" datetime="<?php echo get_the_time('c'); ?>"><?php the_time('F j'); ?></time></p> upcoming_services_widget.php lines 53-64 <p class="small"><?php
global $post;
$terms = wp_get_post_terms($post->ID, 'uu_service_speaker');
$count = count($terms);
if ( $count > 0 ) {
$aNames = [];
foreach ( $terms as $term ) {
$aNames[] = $term->name;
}
echo '<span class="speaker">' . implode(", ", $aNames) . "</span>";
}
?> <time class="" datetime="<?php echo get_the_time('c'); ?>"><?php the_time('F j'); ?></time></p> Chris: If this code is in github, I'd be happy to update it there and submit a pull request.
- multiple speakers have no separation between them
- if there are no speakers, then the date is not left-aligned with the service title and paragraph
global $post;
$terms = wp_get_post_terms($post->ID, 'uu_service_speaker');
$count = count($terms);
if ( $count > 0 ) {
$aNames = [];
foreach ( $terms as $term ) {
$aNames[] = $term->name;
}
echo '<span class="speaker">' . implode(", ", $aNames) . "</span>";
}
?> <time class="" datetime="<?php echo get_the_time('c'); ?>"><?php the_time('F j'); ?></time></p> upcoming_services_widget.php lines 53-64 <p class="small"><?php
global $post;
$terms = wp_get_post_terms($post->ID, 'uu_service_speaker');
$count = count($terms);
if ( $count > 0 ) {
$aNames = [];
foreach ( $terms as $term ) {
$aNames[] = $term->name;
}
echo '<span class="speaker">' . implode(", ", $aNames) . "</span>";
}
?> <time class="" datetime="<?php echo get_the_time('c'); ?>"><?php the_time('F j'); ?></time></p> Chris: If this code is in github, I'd be happy to update it there and submit a pull request.