[Support request] disable category meta href links

Home Forums Support [Support request] disable category meta href links

Home Forums Support disable category meta href links

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1058674
    Jesse

    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!

    #1058702
    David
    Staff
    Customer Support

    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.

    #1492537
    Arnaud

    Hi,

    Great work ! Generatepress is great !

    Do you have an idea in order to delete the tag / category “a href”.

    Many thanks !

    #1493502
    Tom
    Lead Developer
    Lead Developer

    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;
    }
    #1495825
    Arnaud

    Many thanks for the reply. No solution ? Snippet code or create a child theme ?
    Many thanks again !

    #1496163
    Tom
    Lead Developer
    Lead Developer

    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' )
        );
    } );
    #1497037
    Arnaud

    Many thanks Tom 🙂

    But it seems not working. Links still.
    Many thanks again !

    #1497631
    Tom
    Lead Developer
    Lead Developer

    Hmm, strip_tags() removes all HTML, including the link.

    Any other similar functions on the site?

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