SOLVED: Meta Tags Seperator Not Working

Bricks Version: 1.1.3
Browser: Chrome 90
OS: macOS / Windows / Linux / etc.
URL: After a year that disrupted the industry, global rankings show that fintech is thriving - Middle East & Gulf News | AME Info

Create a meta tag element and try to change the seperator

image

Still showing commas

Hope we can remove the seperator tried adding a space or making it white color still the same

Hello @wissam

The separator control is meant to define the separator between each meta, not the meta content itself. We’re studying alternatives for what you’re trying to achieve.

Ah yes true. Hmmm trying to find a way to remove the comma somehow even if temporary until a fix from your side. As we went live and looks weird.

1 Like

Hello @wissam,

Bricks 1.3.2 has two possibilities for you:

  1. Use the new dynamic data filter to set the separator: For a space use {post_terms_post_tag: } ; for a pipe use {post_terms_post_tag: | }

  2. Hook on the new WP filter ‘bricks/dynamic_data/post_terms_separator’ and set the post terms separator globally for all the dynamic data “post_terms_” tags. As one example:

    <?php
    add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
         return ' : ';
     }, 10, 3 );
3 Likes

Great thx downloading now.

1 Like

Hello I am trying with bricks v.1.5.5 the first option but it is not working, is it a bug or I am missing something?
I am trying with:
{post_terms_post_tag: } (space after the colon) or something else like the pipe as you suggested but I am always get the comma as separator.

{post_terms_post_tag: }

result:
Tag1, Tag2, Tag3

The documentation page about Filters on dynamic data says that is possible “Post term separator”

:text value – Depending on the context it could mean the following:

User or term custom field meta key
The URL parameter key
Post terms separator
Date format
Image size slug (e.g. thumbnail, or full)
The echo tag function name

Hey Sandro,
we’ll fix this in Bricks 1.5.6 which will be available soon :slight_smile:

Best regards,
timmse

2 Likes

Hi Sandro,
We’ve fixed this bug in Bricks 1.5.6, now available as a one-click update within your WordPress Dashboard.

Please let us know if you are still experiencing issues.

Best regards,
timmse

@timmse I have another situation here :slight_smile:

So with the post Element I need to show meta Category field (only one the parent) and I need to make it linked.

When I try
{post_terms_category:link} Shows all Categories and correctly linked
{post_terms_category:1} | Shows 1 Category correctly but not linked
{post_terms_category:1:link} Shows 1 category but linked to the post link

How can I have it Show 1 category with a link to the category?

Thanks

1 Like

Hey,
<a href="{site_url}/category/{post_terms_category: :1}">{post_terms_category: :1}</a>
should work.

1 Like

Thanks @timmse but that won’t work if the Category Title has more than one word with spaces getting 404

Aaaah multiple words :smiley:
Currently, there is no filter to show only one category, but thankfully you can use your own function and call it via {echo:yourFunction}

Something like this should work:

// Filter to show the first category assigned to the post

add_filter( 'wp_get_object_terms', 'my_prefix_filter_terms', 10, 4 );
function my_prefix_filter_terms( $terms, $object_ids, $taxonomies, $args ) {
    if ( ! empty( $terms ) && is_array( $taxonomies ) && in_array( 'category', $taxonomies ) ) {
        return [ $terms[0] ];
    }
    return $terms;
}

Reference: wp_get_object_terms | Hook | WordPress Developer Resources

1 Like

@timmse

weird coming up empty
image