function get_testimonials($array) { ob_start(); $count = 1; foreach ($array as $item) { $text = pl_array_get('text', $item); $cite = pl_array_get('cite', $item); $email = pl_array_get('email', $item); $cite = $cite ? sprintf('<cite>%s</cite>', $cite) : ''; if ($text == '') { continue; } $avatar = get_avatar($email); $avatar_url = pl_get_avatar_url($avatar); $avatar_data = sprintf('data-avatar="%s"', $avatar_url); ?> <div class="the-testimonial" <?php echo $avatar_data; ?> > <blockquote> <p data-sync="<?php printf('pl_testimonial_array_item%s_text', $count); ?> "><?php echo $text; ?> </p> </blockquote> <?php echo $cite; ?> </div> <?php $count++; } return ob_get_clean(); }
function pl_recent_comments($number = 3) { $comments = get_comments(array('number' => $number, 'status' => 'approve')); if ($comments) { foreach ((array) $comments as $comment) { if ('comment' != get_comment_type($comment)) { continue; } $post = get_post($comment->comment_post_ID); $link = get_comment_link($comment->comment_ID); $avatar = pl_get_avatar_url(get_avatar($comment)); $img = $avatar ? sprintf('<div class="img rtimg"><a class="the-media" href="%s" style="background-image: url(%s)"></a></div>', $link, $avatar) : ''; printf('<li class="media fix">%s<div class="bd"><div class="the-quote pl-contrast"><div class="title" >"%s"</div><div class="excerpt">on <a href="%s">%s</a></div></div></div></li>', $img, stripslashes(substr(wp_filter_nohtml_kses($comment->comment_content), 0, 50)), $link, custom_trim_excerpt($post->post_title, 3)); } } }