How to query post tags in a loop inside a single.php file

Description

Feel free tp change the html structure inside the loop

PHP Source Code

                        
                          <?php 
$tags = get_the_tags(); 
if ($tags) :
    foreach ($tags as $tag) :
?>
    <li>
        <a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>" class="cs-text_btn cs-type2">
            <svg width="26" height="16" viewBox="0 0 26 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M25.7071 8.70711C26.0976 8.31658 26.0976 7.68342 25.7071 7.29289L19.3431 0.928932C18.9526 0.538408 18.3195 0.538408 17.9289 0.928932C17.5384 1.31946 17.5384 1.95262 17.9289 2.34315L23.5858 8L17.9289 13.6569C17.5384 14.0474 17.5384 14.6805 17.9289 15.0711C18.3195 15.4616 18.9526 15.4616 19.3431 15.0711L25.7071 8.70711ZM0 9H25V7H0V9Z" fill="#FF4A17"/>
            </svg>                    
            <span><?php echo esc_html($tag->name); ?></span>              
        </a>
    </li>
<?php 
    endforeach;
endif; 
?>                        
                        


Post Categories