• Resolved igorsulfagher

    (@igorsulfagher)


    I am using a Posts shortcode do display a list of posts based on a Tag. The shortcode looks like this:

    [su_posts template=”templates/CustomTemplate.php” posts_per_page=”4″ taxonomy=”post_tag” tax_term=”265″ order=”desc”]

    I have created a custom template to display the list of posts returned by the shortcode. At the bottom of the list, I would like to display a link to display all the posts that have that tag. Question: how do I get the permalink to the Tag that has been used for the query (considering that I want to make the template generic, so I don’t want to hard-code the tag ID)?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Vova

    (@gn_themes)

    Hi @igorsulfagher,

    you can use the get_term_link() function.

    Thread Starter igorsulfagher

    (@igorsulfagher)

    Hi @gn_themes,

    thanks for the quick answer!

    The get_term_function() works. But I think I didn’t formulate my question correctly: what I need to know is how to figure out the term ID that has been passed to the Query that the code in the template is processing.

    In other words, if I hard-code the term ID (as in get_term_link(265)), I would have to create a different template for each set of articles I want to display on the page. If there is a way of getting the term ID parameter through code, I can use the same template for any term.

    Plugin Author Vova

    (@gn_themes)

    Try $atts['tax_term'].

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Getting the current tag in template’ is closed to new replies.