Using the following code and shorcode, I display 10 tags in the basement of the site:

function getTagListfoot($classes = '') {
    global $post;
    wp_tag_cloud( array( 'taxonomy' => 'tags_type', 'order' => 'RAND', 'number' => '10' ));
    $tagOutput = [];

    if (!empty($tags)) {
        array_push($tagOutput, '<ul class="tag-list '.$classes.'">');
        foreach($tags as $tag) {
            array_push($tagOutput, '<li>'.$tag->name.'</li>');
        array_push($tagOutput, '</ul>');

    return implode('', $tagOutput);

add_shortcode('tagsListfoot', 'getTagListfoot');

Each tag has an additional custom field "Output in the basement?" with a drop-down list of "Yes" and "No". Need to make a check for compliance with "Yes" before displaying the tag. But I can't get the desired result. Is it possible to do this here?

I will be grateful for any help in this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.