Skip to content
themeforge
EN
Start free
Menu
  1. Home
  2. Attribute reference
  3. wp-post-term
Core Blog and posts

Show a post’s category or tag

wp-post-term="category"

A label on a news card or above a post: the category the client chose in the post editor, with a link to its archive.

Where it goes

On an <a>: prints the name and links to the category. On another element only the name.

The value is the taxonomy: category, post_tag, product_cat or your own.

It shows the first term of the post. All of them as badges: wp-post-term-query with a pattern badge inside (wp="term-title-link"). All of them in one line separated by commas: wp-post-terms.

Example: the category above a post

Markup single.html
<article class="post">
  <a class="tag" href="#" wp-post-term="category">Coffee</a>
  <h1 wp="post-title">New autumn menu</h1>
</article>
In the admin Posts → Categories
Categories
  • Coffee
  • Kitchen
  • Events
Post category Kitchen
On the site the post page
Kitchen New autumn menu

What matters

  • A post without a category prints no link at all.
  • Works on single.html and inside the card of a wp-query list.

Common mistakes

The build log is the “Logs” tab of your project on themeforge.pro; the free markup check shows the same notes.

Not like this
<div class="tags">
  <a href="#" wp-post-term="post_tag">Seasonal</a>
  <a href="#" wp-post-term="post_tag">Pumpkin</a>
</div>

Two badges with wp-post-term: both show the same first tag.

Like this
<div class="tags" wp-post-term-query="post_tag">
  <a href="#" wp="term-title-link">Seasonal</a>
</div>

One pattern badge inside wp-post-term-query.

Alternative spelling

wp_post_term works the same: the build gives an identical theme.

Ready when you are

See your site’s WordPress admin before you pay.