I want to get the right link format for the second link, i tried many time to move the a open tag but no way the result is as the image below.
foreach( $terms as $term ) :
echo '<div class="one_half last">';
$customposts = new WP_Query( "taxonomy=$taxonomy&term=$term->slug&posts_per_page=2" );
echo '<ul>';
if( $customposts->have_posts() ): while( $customposts->have_posts() ) : $customposts->the_post();
echo '<li>';
echo '<a href="'.the_permalink().'">'.the_title_attribute(); // The problem
endwhile; endif;
echo '</a></li>';
echo '</ul>';
echo '</div>';
endforeach;
Thanks
