array( 'post_type' => 'testimonials', 'p' => '', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'DESC', ), 'gravatar' => array( 'size' => 96 ), 'content' => 'full' ); return apply_filters( 'arconix_testimonials_defaults', $defaults ); } /** * Gets the gravatar associated with the e-mail address entered in the Testimonial Metabox. * If there is no gravatar it returns an empty string. * * @since 1.0.0 * * @param integer $size size of the gravatar to return * @param boolean $echo echo or return the data * * @return string the e-mail's gravatar or empty string */ function get_gravatar( $size = 60, $echo = false ) { // Get the post metadata $custom = get_post_custom(); // Get the e-mail address and return the gravatar if there is one isset( $custom["_act_email"][0] ) ? $gravatar = get_avatar( $custom["_act_email"][0], $size ) : $gravatar = ''; if ( $echo ) echo $gravatar; else return $gravatar; } function get_content( $content = 'full', $echo = false ) { if ( $content == 'excerpt' ) $s = get_the_excerpt(); else $s = apply_filters( 'the_content', get_the_content() ); if ( $echo === true ) echo $s; else return $s; } /** * Get the testimonial citation information. * * @since 1.0.0 * * @param boolean $show_author show the author with the citation * @param boolean $wrap_url wrap the URL around the byline * @param boolean $echo echo or return the citation * * @return string text of citation */ function get_citation( $show_author = true, $wrap_url = true, $echo = false ) { // Grab our metadata $custom = get_post_custom(); isset( $custom["_act_byline"][0] ) ? $byline = $custom["_act_byline"][0] : $byline = ''; isset( $custom["_act_url"][0] ) ? $url = esc_url( $custom["_act_url"][0] ) : $url = ''; // Author if ( $show_author ) $author = '
'; else $author = ''; // Separator if ( ! $show_author || strlen( $byline ) == 0 ) $sep = ''; else $sep = apply_filters( 'arconix_testimonial_separator', ', ' ); // Byline if ( strlen( $byline ) != 0 ) { $before = ''; // URL if ( $wrap_url && ! strlen( $url ) == 0 ) { $before .= ''; $after = '' . $after; } } else { $before = ''; $after = ''; } $r = $author . $sep . $before . $byline . $after; if ( $echo ) echo $r; else return $r; } /** * Returns the testimonial loop results * * @since 1.0.0 * @version 1.1.1 * * @param array $args query arguments * @param boolean $echo echo or return results * * @return string $return returns the query results */ function loop( $args, $echo = false ) { $plugin_defaults = $this->defaults(); $defaults = $plugin_defaults['query']; $defaults['gravatar_size'] = $plugin_defaults['gravatar']['size']; $defaults['content'] = $plugin_defaults['content']; // Combine the passed args with the function defaults $args = wp_parse_args( $args, $defaults ); $args = apply_filters( 'arconix_get_testimonial_data_args', $args ); // Extract the avatar size and remove the key from the array $gravatar_size = $args['gravatar_size']; unset( $args['gravatar_size'] ); $content = $args['content']; unset( $args['content'] ); // Run our query $tquery = new WP_Query( $args ); ob_start(); if( $tquery->have_posts() ) { echo '