• I run a website for a newspaper and I would like to make it clear when a reader is looking at a post in the Opinion category (including editorials and letters to the editor). I would like an image or something to appear at the top or bottom of the post on every post in that category that makes it perfectly clear it is an opinion piece.

    I’ve found that many readers don’t understand the difference between a letter to the editor and a regular news article. If I could automatically display this, it would make my life a lot easier. Can someone explain what my options are?

    This is my website: http://hicksvillenews.com/category/opinions/ and I am running Newspaper theme version: 7.1.1.

    If this is the wrong place to ask, please direct me to the right place! Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    if you look at the <body> tag for that post

    <body class="archive category category-opinions category-6 td_category_template_4 td_category_top_posts_style_1 wpb-js-composer js-comp-ver-4.11.2 vc_responsive td-animation-stack-type0 td-full-layout" itemscope="itemscope" itemtype="http://schema.org/WebPage">

    you’ll see that the category is in there as a class, so you can use

    .category-opinions as selector to modify any CSS specifically for that category, including setting a background image, background colors, etc.

    Thread Starter wordpress_Port

    (@wordpress_port)

    Hi Steve,

    Thanks so much for your response. It’s a little above my head though. I am able to set a background for the category through the theme panel (for example: http://hicksvillenews.com/2017/06/14/tenure-protects-more-than-vacation-time/ ), but it doesn’t do anything to alert readers that they are reading an opinion.

    I would ideally like to have a heading that specifies this is an opinion that automatically appears above every article in that category.

    I hope that makes sense. And if I’ve misunderstood your suggestion, I’m sorry. Maybe you can break it down a little simpler? I have inserted custom css code before, but I’d need to know exactly what and where to place it.

    Thanks!

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    The CSS would depend on what you want to do, but if you want to add a heading or text to content, I think I’d do it by writing a filter on the_content and testing to see what category I’m in.

    https://codex.ww.wp.xz.cn/Plugin_API/Filter_Reference/the_content

    If coding is above your head, you might want to hire a developer to do this for you. Unless I’m misunderstanding the requirements, it’s not terribly difficult.

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

The topic ‘How visually differentiate posts in different categories?’ is closed to new replies.