Skip to content
The Admin Bar
  • Get Involved
    • Facebook Group
    • Barfly Community
    • TABLE Mastermind
  • Learn
    • 2026 Survey
    • Articles
    • Events
    • Newsletter
    • YouTube
    • WordPress Professionals Survey
    • SEO Weekly
    • Security Weekly
    • Accessibility Weekly
  • Products
    • The Paid Discovery Class
    • Website Owner’s Manual
    • Agency Copilot
    • Website Pricing Calculator
    • Agency Airtable Pack
    • Prospect Pipeline Challenge
    • Easy-Peasy Proposal
    • TAB Swag
  • About
  • Free Stuff

Using Custom Taxonomies and CSS to Target Specific Items in a Query Loop

While building out a Black Friday deals page this week, I ran into a challenge: I needed to highlight specific items inside a Query Loop without affecting all the items. If you’ve worked with …

Kyle Van Deusen

Published:

November 10, 2023

Filed Under:

General

Kyle Van Deusen

The Admin Bar

After spending 15 years as a graphic designer and earning a business degree, I launched my agency, OGAL Web Design, in 2017. A year later, after finding the amazing community around WordPress, I co-found The Admin Bar, which has grown to become the #1 community for WordPress professionals. I'm a husband and proud father of three, and a resident of the Commonwealth of Virginia.

Feels like magic

This content contains affiliate links. View our affiliate disclaimer.

While building out a Black Friday deals page this week, I ran into a challenge: I needed to highlight specific items inside a Query Loop without affecting all the items. If you’ve worked with Query Loops before, you know that anything you add to the loop applies to every item displayed.

To solve this problem, I used a custom taxonomy combined with a bit of CSS. This solution is quick to implement, provides a lot of flexibility, and can be adapted for various use cases. In this post, I’ll walk you through the exact situation I faced and the steps I took to solve it.

Youtube video

The Problem

On my Black Friday deals page, I had three separate Query Loops:

  • Gold placements
  • Silver placements
  • Bronze placements

Each loop displayed a set of deals, and I wanted to highlight the products I created by adding a small verified badge in the top-right corner of those items.

The challenge was that Query Loops repeat the same structure for every item, so there’s no way to add an icon to just specific items without affecting all of them.

The Solution

To target specific items, I used a custom taxonomy to assign a unique class to those items. Then, I wrote CSS to style only the items with that class.

Step 1: Create a Custom Taxonomy

First, I created a custom taxonomy using Advanced Custom Fields (ACF). You can use the free version of ACF for this.

  1. Add a New Taxonomy:
    • In the WordPress admin, hover over ACF and click Taxonomies.
    • Click Add New and name the taxonomy (e.g., “Origin”).
    • Set the plural label to “Origins” and the singular label to “Origin.”
  2. Configure the Taxonomy:
    • Enable the checkbox option for easier selection.
    • Assign the taxonomy to the relevant post type (in my case, a custom post type called “Deals”).
  3. Save Changes:
    • Click Save Changes to create the taxonomy.

Step 2: Add Taxonomy Terms

Next, I added terms to the taxonomy.

  1. Go to the Taxonomy:
    • Under the “Deals” post type, click on the new “Origins” taxonomy.
  2. Add Terms:
    • Create a term called “Internal” to represent products I created.
    • Optionally, add other terms like “External” for products from other sources.

Step 3: Assign the Taxonomy to Posts

To apply the taxonomy to specific posts:

  1. Edit Posts:
    • Go to All Deals and edit the posts you want to highlight.
    • In the post editor, check the “Internal” box under the “Origins” taxonomy.
  2. Save Changes:
    • Update the posts to apply the taxonomy.

Step 4: Inspect the Front End

At this point, there won’t be any visible changes on the front end. However, if you inspect the page using your browser’s developer tools, you’ll see that the taxonomy has added a new class to the relevant items.

For example:

  • The post with the “Internal” taxonomy will have a class like origin-internal.
  • Posts without the taxonomy won’t have this class.

Step 5: Write CSS

Now that the taxonomy is adding a unique class to the items, we can use CSS to style them.

  1. Open the Customizer:
    • Go to Appearance > Customize and open the Additional CSS section.
  2. Target the Class:
    • Write CSS to target the origin-internal class.
    • Start by adding a temporary outline to confirm you’re targeting the correct items:

css

.origin-internal {
  outline: 1px solid red;
}

Once confirmed, you can style the items as needed.

Adding the Verified Badge

To add the verified badge, I used a pseudo-element and positioned it in the top-right corner of the item.

  1. Set Positioning:
    • Add position: relative to the parent container:

css

.origin-internal {
  position: relative;
}
  1. Create the Pseudo-Element:
    • Use the ::after pseudo-element to add the badge:

css

.origin-internal::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background-image: url('URL_TO_YOUR_IMAGE');
  background-size: contain;
  top: 24px;
  right: 24px;
}

This positions the badge in the top-right corner of the item.

Step 6: Apply the Taxonomy to Other Posts

To highlight additional posts, simply assign the “Internal” taxonomy to them.

  1. Quick Edit:
    • Use the Quick Edit option in the post list to quickly apply the taxonomy to multiple posts.
  2. Save Changes:
    • Update the posts and refresh the front end.

Now, all posts with the “Internal” taxonomy will display the verified badge.

Step 7: Add Context

To clarify the meaning of the badge, I added a note at the bottom of the page:

“The verified icon indicates an official Admin Bar product.”

This helps users understand the significance of the badge.

Other Use Cases

This system isn’t limited to Black Friday deals pages. Here are a few other ways you could use it:

  • Featured Blog Posts: Highlight specific articles by tagging them with a custom taxonomy and styling them differently.
  • Promoted Products: Add badges or special styling to products you want to promote.
  • Custom Layouts: Use taxonomy-based classes to create unique layouts for certain posts.

The possibilities are endless, and the only limitation is your imagination.

Wrapping Up

Using a custom taxonomy and CSS to target specific items in a Query Loop is a powerful and flexible solution. It allows you to highlight or style individual items without affecting the rest of the loop.

If you try this method, I’d love to see how you use it in your projects. Feel free to share a link—I always enjoy seeing these techniques in action!

Happy designing!

Kyle Van Deusen

The Admin Bar

After spending 15 years as a graphic designer and earning a business degree, I launched my agency, OGAL Web Design, in 2017. A year later, after finding the amazing community around WordPress, I co-found The Admin Bar, which has grown to become the #1 community for WordPress professionals. I'm a husband and proud father of three, and a resident of the Commonwealth of Virginia.

Come Join Us!

Join the #1 WordPress Community and dive into conversations covering every aspect of running an agency!

Join Group

Kyle Van Deusen

Community Manager

Latest Events

February, 26th, 2026

Code Snippets Are Slowing Down Your Website

Why Perfmatters Built a Performance-First Snippet Manager

January 20th, 2026

Revolutionizing How Small Agencies Grow Their Business Efficiently

September 16, 2025

Termageddon 2.0

Better Tools, Smoother Workflows, Happier Clients
Tpdc onblue

Learn a proven discovery framework to transform casual leads into high-paying clients.

View the Course
The Friday Chaser

Wash down the week with the best of The Admin Bar! News, tips, and the best conversations delivered straight to your inbox every Friday!

Subscribe Today

More Articles

A smiling man with glasses and a patterned shirt, member profile on The Admin Bar website.
May 20, 2026

Member Spotlight: Mayank Majeji

Mayank Majeji’s story feels a lot like the way many of us got into this industry: …

A woman working on a laptop with a large pill bottle labeled "Free Privacy Policy Template" on the t.
May 19, 2026

Why Privacy Policy Templates Can Backfire for Agencies and Website Owners

Free Privacy Policy templates seem harmless until a client gets sued. Here’s what every web agency needs to know before using one.

Close-up of a "Sold" sign hanging on a wooden frame in front of a house.
May 19, 2026

The Industry Web Agencies Should Be Copying

Real estate agents have spent 100 years mastering referral marketing. Here’s how web agencies can borrow their best moves.

2025phone

Join the #1 WordPress Community

The Admin Bar community is at the heart of what we do. Join in on the daily conversation and get involved.

Request Membership
The Admin Bar logo.

Explore

Community

Events

Articles

Products

Newsletter

Agency Report Card

Care Plan Toolkit

Noted!

Barfly Login

Policies

Privacy Policy

Terms of Service

Affiliate Agreement

Affiliate Disclaimer

Accessibility Statement

Privacy Settings

Misc.

Advertise

Login

Contact

Hosted with Rocket.net

© 2017-2026 The Admin Bar (a Division of OGAL Web Design) — All Rights Reserved

The Admin Bar logo.
  • Get Involved
    • Facebook Group
    • Barfly Community
    • TABLE Mastermind
  • Learn
    • 2026 Survey
    • Articles
    • Events
    • Newsletter
    • YouTube
    • WordPress Professionals Survey
    • SEO Weekly
    • Security Weekly
    • Accessibility Weekly
  • Products
    • The Paid Discovery Class
    • Website Owner’s Manual
    • Agency Copilot
    • Website Pricing Calculator
    • Agency Airtable Pack
    • Prospect Pipeline Challenge
    • Easy-Peasy Proposal
    • TAB Swag
  • About
  • Free Stuff
YouTube Facebook
Sell More Care Plans