-
Anonymous
Hello Support Team,
I would like to change an icon on the category page.
I want to remove the entire block and replace it with my own icon.Where can I make this change?
Current Code:
<footer class="entry-meta" aria-label="Beitragsmeta"> <span class="cat-links"><span class="gp-icon icon-categories"><svg viewBox="0 0 512 512" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"><path d="M0 112c0-26.51 21.49-48 48-48h110.014a48 48 0 0143.592 27.907l12.349 26.791A16 16 0 00228.486 128H464c26.51 0 48 21.49 48 48v224c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112z"></path></svg></span><span class="screen-reader-text">Kategorien </span><a href="https://www.xyz.de">Vereinigte Staaten von Amerika</a>, <a href="https://www.xyz.de">New York City</a>, <a href="https://www.xyz.de">Gedenkstätten</a></span> </footer>To replace:
<span class="cat-links"><span class="gp-icon icon-categories"><svg viewBox="0 0 512 512" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"><path d="M0 112c0-26.51 21.49-48 48-48h110.014a48 48 0 0143.592 27.907l12.349 26.791A16 16 0 00228.486 128H464c26.51 0 48 21.49 48 48v224c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112z"></path></svg></span>New Icon:
<svg class="icon"><use href="#folder"></use></svg>Target:
<footer class="entry-meta"><span><svg class="icon"><use href="#folder"></use></svg><a href="https://www.xyz.de">Vereinigte Staaten von Amerika</a>, <a href="https://www.xyz.de">New York City</a>, <a href="https://www.xyz.de">Gedenkstätten</a></span></footer>Is that easily possible?
Kind regards
Jens -
Hi Jens,
Try this PHP snippet:
add_filter( 'generate_svg_icon_element', function( $output, $icon ) { if ( 'categories' === $icon ) { $output = '<svg class="icon"><use href="#folder"></use></svg>'; } return $output; }, 10, 2 );Adding PHP: https://docs.generatepress.com/article/adding-php/
For more info about this PHP filter: https://docs.generatepress.com/article/generate_svg_icon_element/
-
Anonymous
Hello Ying,
That worked wonderfully—thank you very much.
Kind regrads
Jens -
You are welcome 🙂
- You must be logged in to reply to this topic.