<?php

// Get value from WordPress get_tags() function and stored in $header_tags variable
$header_tags = get_tags(array(
	'number' => 12,
	'orderby' => 'count',
	'order'   => 'DESC',
));

// Check if has tag
if ($header_tags) { ?>
	<div class="site-header-tags">
		<div class="container">
			<span class="site-header-tags--item title">
				<i class="icon-chart"></i> <?php esc_html_e('Trending', 'viralike'); ?> <i class="icon-angle-right"></i>
			</span>
			<?php
			// Fetch data from array argument using foreach loop
			foreach ($header_tags as $tag_single) {
				echo '<a class="site-header-tags--item" href="' . esc_url(get_tag_link($tag_single->term_id)) . '">' . esc_html($tag_single->name) . '</a>';
			} ?>
		</div>
	</div>
<?php } ?>
