Hello I am working with my own template, and I am doing the following
echo '<div class="legal_list">';
$count=0;
$tags = get_tags();
if ($tags) {
echo '<div class="left_list">';
echo '<ul>';
foreach ($tags as $tag) {
$count++;
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </li> ';
if( $count > 5 ) break;
}
echo '</ul>';
echo '</div>';
}
if ($tags) {
echo '<div class="right_list">';
echo '<ul>';
foreach ($tags as $tag) {
$count++;
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </li> ';
if( $count > 5 ) break;
}
echo '</ul>';
echo '</div>';
}
echo '</div>';
Expected result
I want to display list of 5 tags in both the div's i.e <div class="left_list"> & <div class="right_list">. To display 5 posts in both the tag lists I created $count and was incrementing upto 5 tags and I dont want to print duplicate tags in these two div's. So, how can I achieve this? How can i display tags in between both the div's without printing duplicate ones?
Aucun commentaire:
Enregistrer un commentaire