[Support request] Filter dynamic data

Home Forums Support [Support request] Filter dynamic data

Home Forums Support Filter dynamic data

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2349222
    Kees

    Hi,

    Is there a way to limit dynamic data. When we use gutenberg with dynamic data. We would like to show specic dynamic tags. But not all tags. Is there a way to filter the tags in dynamic data.

    See attached video.

    Regards,
    Niek

    #2349242
    Fernando
    Customer Support

    Hi Kees,

    You’ll need to create a Shortcode to retrieve for instance just the first tag. Example code:

    add_shortcode( 'display_single_tag_term', function() {
    	//$termslist = get_the_term_list( get_the_ID(), 'tag', '', ', ');
    	$terms = get_the_terms( get_the_ID(), 'post_tag');
    	$term_link = get_term_link( (int) $terms[0]->term_id, 'post_tag');
    	$term_name = $terms[0]->name;
        ob_start();
        // Start your PHP below
      
        echo '<a href="'.$term_link.'" rel="post_tag" class="custom-single-tag">'.$term_name.'</a>';
      
        // End your PHP above
        return ob_get_clean();
    } );

    You can then place this Shortcode [display_single_tag_term] in a Shortcode Block within a Container Block. Then, style the Container Block instead.

    #2349246
    Kees

    Nice, thank! i will try that.

    #2350115
    Fernando
    Customer Support

    You’re welcome Kees!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.