WordPress.org

Support

Support » Themes and Templates » If post has this tag Then add class to thumbnail

If post has this tag Then add class to thumbnail

  • I’m working on a custom page template and am trying to accomplish the following.

    If my post has the tag “monkeys” (for example) them I want the class “tag-monkeys” added to the thumbnail so that the proper style is applied.

    I’ve been messing with it for a bit but haven’t had any success. Has anyone else managed something similar?

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you added the <?php post_class(); ?> on the posts then it already has the tags as classes. So if thumbnails are inside the article/post tags then your css would be like this:

    .tag-monkeys .thumbnail {}

    Hm. I’m using a custom theme and it looks like they do a lot of crazy calls to/from other files so it’s out of the loop. I’ll keep picking away at it, thanks though.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If post has this tag Then add class to thumbnail’ is closed to new replies.
Skip to toolbar