Forums

Need to Place link in template that targets specific taxonomy term (3 posts)

  1. laughhearty
    Member
    Posted 2 years ago #

    Hello,
    I've spent hours trying to figure this out.
    Here's what I want to do:

    I have registered a custom post type called: "portfolio"
    I've registered a taxonomy called "wwd"
    I created a new Portfolio and gave it 4 wwd's:
    "Business Innovation", <emi>"Public Relations", "Social Media Marketing" & "Visual Productions".

    Each of these terms is also represented by a page, meaning I created 4 pages with titles that correspond to the term names. On the page, Business Innovation, for example, I have a short explanation of the service. At the end of this text I have linked text that says: "See the clients we've helped with this service". I want to link that phrase to the specific term Business Innovation which will bring up the "Business Innovation term page displaying all of the other clients who've gotten the service.

    I thought get_term_link would work quite easily, but I'm not much of a php coder and I've spent over 4 hours trying to decipher different answers I'm finding on the internet. I'm finally calling uncle.

    There has got to be an easy way to do this.

    Thanks in advance

  2. jkovis
    Member
    Posted 2 years ago #

    Did you try something like:

    <?php
        $term_slug = $post->post_name;
        echo get_term_link( $term_slug, 'wwd');
    ?>
  3. laughhearty
    Member
    Posted 2 years ago #

    Hi jkovis,
    Thanks for your reply.
    I have a link working with this:

    <h3><a href="<?php echo get_term_link('business-innovation', 'wwd'); ?>">See the clients we've helped with this service!</a></h3>

    but when I click the link I get a list of all posts even one's without a taxonomy.

    I should only get one post: the one with the business innovation taxonomy.

Topic Closed

This topic has been closed to new replies.

About this Topic