If your theme uses body_class
and post_class
then you should have CSS enough to do this.
Make a <div>
for your icon.
<div class="mycategoryicon"></div>
Add some style.
.category-slug .mycategoryicon {
height:32px;
width:32px;
background:#ffffff url('slug-icon.jpg') no-repeat;
}
The “slug” part of the class name should be your actual category slug. Height and width can of course be whatever you need.
Related Posts:
- Pagination not working with custom loop
- How to Debug the ‘save_post’ Action?
- set_post_thumbnail_size in percent, not pixels?
- Breadcrumbs with Custom Post Types?
- How to query for posts (in hierarchical custom post type) that have children?
- 404 error PageNavi custom type taxonomy | wordpress
- Running a function on post content and CPT meta
- Get the post_type of current taxonomy or category page
- get_the_post_thumbnail() returning empty string on custom post type
- Query for posts in 2 taxonomies
- How do I create an archive page for standard posts?
- WordPress custom post type archive with description
- Custom post types – show specific posts
- custom taxonomy archive by year
- Add management screens to post type
- Updating post title using wp_update_post
- Remove parent from custom post type
- Metabox Populated with a Custom Post Type – How to Output CPT based on Select?
- Can custom taxonomies items have attached properties?
- WordPress if in term*
- Associate custom post types with normal posts
- Troubles with making a custom template for posts
- Combining sorted and random CPT
- how to delete all users and posts based on ‘user_meta’?
- hide a certain custom field
- Query with no terms uses index.php template instead of archive.php
- Sort by alphabetical order archive.php page
- Regex with a possible hyphen
- Expose a custom field of a custom post type to the REST API
- Default text in a specific post type, but not visible?
- Woocommerce custom field search in custom post type [closed]
- get_page_by_title() doesn’t retrieve my post
- Custom rewrite to fetch feed data
- Create custom post with meta field with AJAX and the WordPress REST API
- Specifying meta field’s column type in Database using add_post_meta
- Change “empty trash” button text?
- Front end access to a SQL data repository – recommended way?
- Adding guestbook to my wordpress site
- find custom post type post by searching its custom field with my string
- wordpress lists similar type of posts in a custom post type
- FacetWP paging custom wp_query
- why post_class() function apply css classes to all other files?
- Looping Through Categories of a CPT
- Custom Post Type Template Hierarchy – Single post template
- How do I find a way to create a global single.php for a custom post type?
- Display Date & Author Info on Custom Post Type Archive Page
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- custom post type make featured image box full width
- Cannot get custom posts by category
- How to Display the tag content of Custom Post?
- Convert Custom Table Data Based Plugin To Be Searchable
- Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?
- Control Loop Within Loop
- Sets post_parent in custom post type posts automatically based on cpt->page name
- How to filter Multiple taxonomies with radio buttons
- ACF – Retrieve custom taxonomy from a relationship field
- Restrict access to custom post type based on its taxonomy terms
- How to Print Title and Permalink of CPT Post behalf of Posts Meta Value with WP_Query
- Create loop from selected terms in ACF taxonomy field
- Custom rewrite rule based on other custom post type title
- How is possible to know ID of taxonomy-{taxonomy}.php page for ACF fields
- Sending current featured image to email
- CPT and rewrite rules
- Querying posts that don’t have a certain key value or don’t have the key
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- WordPress custom post type taxonomy paging
- Custom post types not showing on the standard WordPress Category page
- Assign a Post to a User
- List posts that have the current url taxonomy
- Display Custom Post Type in divs
- Output all terms slugs for a loop filter
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- wordpress does not see the correct custom taxonomy hierarchy
- Counting the number of post without custom post type
- Place a button besides “add new”
- Custom Archive – hide posts until a search is made?
- Use WP pagination functions on a custom page template
- register taxonomy url rewrite 404
- Multiple WordPress Sites, Same Database but Filtered Content
- Display result as “prefix+ID” and show in the search result as bookcode
- How to get all posts assigned to a taxonomy term only?
- How to implement custom post type’s users
- Generating excerpts from a custom post type to display in a Widget
- Custom Post Search
- Use Custom Post Type as Storage Container Without Registering It
- Do not output category and tag URLs
- WP_Query function for custom post type
- How can I get taxonomy terms and custom field values of a newly created post
- Custom post type won’t take my custom fields
- Custom content for Custom Post Type parent page?
- Custom post types with date based archive
- Custom post type URL returns 404 error page
- Programmatically Split A Post Into Multiple Pages
- Hide custom post type and use its slug in new plugin menu
- Page template anomaly
- Structure of custom post type / taxonomy?
- Issue On Listing Woocommerce Parent Tag List
- show custom post’s post in two different divs [duplicate]
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Creating post custom field text area