Hello,
I’m developing a general interest magazine website that will cover four article sections: World Affairs, Health & Wellness, Science & Innovation, and Culture & Design. On the backend, the site’s structure will be divided into two main channels: daily-updated free content and monthly premium content that’s restricted to paid subscribers. (A typical url structure would be: mysite.com/free-content-channel/article-view/article-title). All articles in both channels will fall into one of the four aforementioned sections (World Affairs, etc). These article sections are assigned to each article as a category.
Here’s the issue: each article section is meant to have slightly different styling; a different color to visually orient a reader on the website. These colors need to dynamically appear in single-article-view templates as well on home/navigation pages (ie, each article excerpt and “read more” link will have it’s color determined by it’s article section). The colors appear based on specific class names. For example: on a list of articles on a navigation page, a Culture & Design article would appear with: <li class=“cltDsng”>. That same article in an single-article-view page would appear with: <html class=“cltDsng”>.
My question is, how can I get these classes to appear dynamically based on the article’s category. I understand that it will likely involve conditional statements but how can I access the article’s category without the benefit of using the url segments (as it stands, the article’s category doesn’t appear in the url title)?
Here’s a link to a static article-view page so you can get an idea of where I’m coming from. I should mention, if it isn’t obvious, I’m still familiarizing myself with ExpressionEngine. So any help is greatly appreciated.