Show post term list but without links

Support MB Views Show post term list but without linksResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30364
    JonSJonS
    Participant

    Hi there

    I'm using the mb.get_post_term_list within an MB View and it displays fine but always links to the archive page for that term. I just want to show the list, comma-separated just the same, but as plain text and not linking.

    How can I do that?

    My existing code is this:

    {{ mb.get_the_term_list( post.ID, 'fixture-venue', '', ', ' ) }}

    Many thanks.

    #30370
    Long NguyenLong Nguyen
    Moderator

    Hi Jon,

    You can use the function get_the_terms() of WordPress to get post terms and show them. For example

    <div class="list-terms">
        {% set terms = mb.get_the_terms( post.ID, 'fixture-venue' ) %}
        {% for term in terms %}
            {{ term.name }}
        {% endfor %}
    </div>

    Get more details on this documentation https://docs.metabox.io/extensions/mb-views/#running-php-functions

    #30541
    JonSJonS
    Participant

    That worked perfectly. Thanks for that.

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