Adding Custom Taxonomy links to Shortcode results?

Forums › Forums › Search & Filter Pro › Adding Custom Taxonomy links to Shortcode results?

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #259050

    Hello,
    I’d like to list particular custom taxonomy links in my shortcode results (the way categories and tags are already listed).

    In the results.php file (saved in a child theme), how do I go about that? I’m guessing it’s to do with the_terms(), but I’m struggling to set it up.

    <div>
    <h2>“><?php the_title(); ?></h2>

    <p><?php the_excerpt(); ?></p>

    <p><?php the_category(); ?></p>
    the_terms() ???
    <p><small><?php the_date(); ?></small></p>

    </div>

    For example I have a taxonomy with an ID called ‘content-type’ which I’d like to list.

    Any help would be brilliant.
    Many thanks

    Trevor
    #259062

    Ah, I see. And each term needs to be a link to the archive page of that term? You need to use the WordPress get_the_term_list() function.

    Like this:

    <?php echo get_the_term_list( get_the_ID(), 'content-type', 'Content Type: ', ', ' ); ?>

    Anonymous
    #259064

    That’s perfect – many thanks Trevor.

    Trevor
    #259066

    Thanks for getting back to me. I will close this thread for now.

Viewing 4 posts – 1 through 4 (of 4 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.