Look at the declaration of the function the_title()
, it prints the title, if the third parameter $echo
is set to TRUE
which is the default:
/**
* Display or retrieve the current post title with optional content.
*
* @since 0.71
*
* @param string $before Optional. Content to prepend to the title.
* @param string $after Optional. Content to append to the title.
* @param bool $echo Optional, default to true.Whether to display or return.
* @return null|string Null on no title. String if $echo parameter is false.
*/
function the_title($before="", $after="", $echo = true) {
$title = get_the_title();
if ( strlen($title) == 0 )
return;
$title = $before . $title . $after;
if ( $echo )
echo $title;
else
return $title;
}
So either you use the_title( '', '', FALSE )
or even better get_the_title()
because it makes the code better readable:
$title = get_the_title();
$args = array(
'post_type' => 'Testimonials',
'order' => 'ASC',
'category_name' => $title
);