Site logo

Archived topic

Remove commas from tags

5 replies · Started by Daniel on November 28, 2019

Viewing posts 1–6 of 6

Hi,

when I use this code provided by Tom (only the part regarding the commas), the icon before the text is no longer visible (gp-icon icon-tags).

On another dev/test site, the code works, the icon is visible and the comma is removed. But on my prod/staging site, the icon is no longer visible.

Maybe you could take a look at the staging site, what's wrong?

Thank you very much!

Daniel

Hi Leo,

no, sorry - it's not fixed :-(

Currently, it look like this (as seen on your screenshot too):
https://prnt.sc/q3iy0z

But, it should look like this:
https://prnt.sc/q3iylf

On the first screenshot, the icon (before the tags) is missing, but I've no idea why. On another testing site I've used the same code snippet and CSS and the icon and tags list looks normal.

Thank you!

Daniel

I believe one site is using font icon and the other is using SVG:
https://docs.generatepress.com/article/svg-icons/

Try this snippet instead:

add_filter( 'generate_tag_list_output', function( $output ) {
    $tags_list = get_the_tag_list( '', '' );

    return sprintf( '<span class="tags-links"><span class="gp-icon icon-tags"><svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
						<path d="M20 39.5c-8.836 0-16 7.163-16 16v176c0 4.243 1.686 8.313 4.687 11.314l224 224c6.248 6.248 16.378 6.248 22.626 0l176-176c6.244-6.244 6.25-16.364.013-22.615l-223.5-224A15.999 15.999 0 0 0 196.5 39.5H20zm56 96c0-13.255 10.745-24 24-24s24 10.745 24 24-10.745 24-24 24-24-10.745-24-24z"></path>
						<path d="M259.515 43.015c4.686-4.687 12.284-4.687 16.97 0l228 228c4.686 4.686 4.686 12.284 0 16.97l-180 180c-4.686 4.687-12.284 4.687-16.97 0-4.686-4.686-4.686-12.284 0-16.97L479.029 279.5 259.515 59.985c-4.686-4.686-4.686-12.284 0-16.97z" fill-rule="nonzero"></path>
					</svg></span><span class="screen-reader-text">%1$s </span>%2$s</span>', // WPCS: XSS ok, sanitization ok.
        esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ),
        $tags_list
    );
} );

Hi Leo,

yes, you're right! One site is using font icon, the other SVG.

Your code snippet fixed the problem.

Thank you very much!

Daniel

No problem :)

This archived topic is closed to new replies.