Archived topic
disable category meta href links
7 replies · Started by Jesse on November 10, 2019
Hi, I am including category meta info in the page hero of my posts, and this works fine. Trouble is, I don't want that meta info to link to the category archive pages. How can I achieve this? Thanks in advance!
Hi there,
simplest way would be this CSS to remove the pointer event on the link:
.page-hero h2 a {
pointer-events: none;
}
Then in the Header Element you change the Link color to white.
Hi,
Great work ! Generatepress is great !
Do you have an idea in order to delete the tag / category "a href".
Many thanks !
Removing the href completely would be difficult, but you could use the same method David used:
.cat-links a,
.tags-links a {
pointer-events: none;
}
Many thanks for the reply. No solution ? Snippet code or create a child theme ?
Many thanks again !
You could try this:
add_filter( 'generate_category_list_output', function() {
return sprintf(
'<span class="cat-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ',
esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ),
strip_tags( get_the_category_list( ', ' ) ),
apply_filters( 'generate_inside_post_meta_item_output', '', 'categories' )
);
} );
add_filter( 'generate_tag_list_output', function() {
return sprintf(
'<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ',
esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ),
strip_tags( get_the_tag_list( '', ', ' ) ),
apply_filters( 'generate_inside_post_meta_item_output', '', 'tags' )
);
} );
Many thanks Tom :)
But it seems not working. Links still.
Many thanks again !
Hmm, strip_tags() removes all HTML, including the link.
Any other similar functions on the site?