function easy_testimonials_build_metadata_html($testimonial, $author_class, $show_date, $show_rating, $show_other) { $date_css = easy_testimonials_build_typography_css('easy_t_date_'); $position_css = easy_testimonials_build_typography_css('easy_t_position_'); $client_css = easy_testimonials_build_typography_css('easy_t_author_'); $other_css = easy_testimonials_build_typography_css('easy_t_other_'); $rating_css = easy_testimonials_build_typography_css('easy_t_rating_', 'stars'); //only build the stars CSS, ie the font color only, as the rating displayed by the metadata function is only ever stars //set the following variables to true if the option to display the associated item is true and the associated item has content in it (preventing outputting blank items that insert whitespace) $show_the_client = strlen($testimonial['client']) > 0 ? true : false; $show_the_position = strlen($testimonial['position']) > 0 ? true : false; $show_the_other = strlen($testimonial['other']) > 0 && $show_other ? true : false; $show_the_date = strlen($testimonial['date']) > 0 && $show_date ? true : false; $show_the_rating = strlen($testimonial['num_stars']) > 0 && $show_rating == "stars" ? true : false; ?> <p class="<?php echo $author_class; ?> "> <?php //if any of the items have data and are set to be displayed, construct the html ?> <?php if ($show_the_client || $show_the_position || $show_the_other || $show_the_date || $show_rating == "stars") { ?> <cite> <?php if ($show_the_client) { ?> <span class="testimonial-client" itemprop="author" style="<?php echo $client_css; ?> "> <?php echo $testimonial['client']; ?> <?php if ($show_the_position) { ?> <span class="testimonial-position" style="<?php echo $position_css; ?> "> - <?php echo $testimonial['position']; ?> </span> <?php } ?> </span> <?php } ?> <?php if ($show_the_other) { ?> <span class="testimonial-other" style="<?php echo $other_css; ?> " itemprop="itemReviewed"><?php echo $testimonial['other']; ?> </span> <?php } ?> <?php if ($show_the_date) { ?> <span class="date" itemprop="datePublished" content="<?php echo $testimonial['date']; ?> " style="<?php echo $date_css; ?> "><?php echo $testimonial['date']; ?> </span> <?php } ?> <?php if ($show_the_rating) { ?> <?php if (strlen($testimonial['num_stars']) > 0) { ?> <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="stars"> <meta itemprop="worstRating" content="1"/> <meta itemprop="ratingValue" content="<?php echo $testimonial['num_stars']; ?> "/> <meta itemprop="bestRating" content="5"/> <?php $x = 5; //total available stars //output dark stars for the filled in ones for ($i = 0; $i < $testimonial['num_stars']; $i++) { echo '<span class="dashicons dashicons-star-filled" style="' . $rating_css . '"></span>'; $x--; //one less star available } //fill out the remaining empty stars for ($i = 0; $i < $x; $i++) { echo '<span class="dashicons dashicons-star-filled empty"></span>'; } ?> </span> <?php } ?> <?php } ?> </cite> <?php } ?> </p> <?php }
function easy_testimonials_build_metadata_html($testimonial, $author_class, $show_date, $show_rating, $show_other) { $date_css = easy_testimonials_build_typography_css('easy_t_date_'); $position_css = easy_testimonials_build_typography_css('easy_t_position_'); $client_css = easy_testimonials_build_typography_css('easy_t_author_'); $rating_css = easy_testimonials_build_typography_css('easy_t_rating_'); ?> <p class="<?php echo $author_class; ?> "> <?php if (strlen($testimonial['client']) > 0 || strlen($testimonial['position']) > 0) { ?> <cite> <span class="testimonial-client" itemprop="author" style="<?php echo $client_css; ?> "><?php echo $testimonial['client']; ?> </span> <span class="testimonial-position" style="<?php echo $position_css; ?> "><?php echo $testimonial['position']; ?> </span> <?php if ($show_other && strlen($testimonial['other']) > 1) { ?> <span class="testimonial-other" itemprop="itemReviewed"><?php echo $testimonial['other']; ?> </span> <?php } ?> <?php if ($show_date) { ?> <span class="date" itemprop="datePublished" content="<?php echo $testimonial['date']; ?> " style="<?php echo $date_css; ?> "><?php echo $testimonial['date']; ?> </span> <?php } ?> <?php if ($show_rating == "stars") { ?> <?php if (strlen($testimonial['num_stars']) > 0) { ?> <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="stars"> <meta itemprop="worstRating" content="1"/> <meta itemprop="ratingValue" content="<?php echo $testimonial['num_stars']; ?> "/> <meta itemprop="bestRating" content="5"/> <?php $x = 5; //total available stars //output dark stars for the filled in ones for ($i = 0; $i < $testimonial['num_stars']; $i++) { echo '<span class="dashicons dashicons-star-filled"></span>'; $x--; //one less star available } //fill out the remaining empty stars for ($i = 0; $i < $x; $i++) { echo '<span class="dashicons dashicons-star-filled empty"></span>'; } ?> </span> <?php } ?> <?php } ?> </cite> <?php } ?> </p> <?php }