This is easily done using a filter on the title, which you can add to your functions.php
. Like this:
add_filter ('the_title', 'wpse305812_add_flag', 10, 2);
function wpse305812_add_flag ($title, $id) {
if (in_category ('england', $id)) $flag = "http://www.example.com/.../england.jpg"
elseif (in_category ('brasil', $id)) $flag = "http://www.example.com/.../brasil.jpg"
...;
return '<img src="' . $flag . '"> ' . $title;
}
Note that this (fairly unelegant) code will not take into account the possibility of two flags assigned to one title.
Related Posts:
- Woocommerce get category image full size
- Display the featured image from the last post
- Add Image Size for one Media Category Only
- Extract image url associated to a category
- Retrieve Image from Media Library by it’s category
- Show category images on single product page and product overview page
- Link Attachment Image to Category
- Change thumbnail image depending product category
- category image taxonomy
- get_post_meta not working on category.php
- Random Featured Image Based on Category
- Category images are not displaying in WordPress
- How do you use the featured image of the most recent post in a category as the background image
- Need to echo category id in multi-dimensional array
- Category view with contents of [gallery]s shown
- How to add image for all posts associated to specified category?
- How to display WooCommerce category image in my category page banner as a background?
- How to make product image inherit from category image
- How to display categories image in loop homepage WordPress
- Change background image page header overlay for each category
- Image Upload Custom Form Field for Category and Custom Taxonomy
- Icon images across multiple categories
- Media Categories as Classes on WordPress Gallery Shortcode
- How to relocate images
- In a shared site, how to get products in a category from one site to another?
- Display one post on category.php: Wrong featured image
- Category page with gallery for each post
- Image menu showing categories in page
- Get all first images of posts in same category
- how do i set an image for a category in admin panel
- How to link images of one WP site to another WP site?
- How to create a photo gallery that can be filtered by the image categories
- Images as Categories
- Multisite – Protect categories from deletion?
- Where/how are categories stored?
- Get top parent category
- How can I prevent users from creating new categories?
- Get child categories when clicking on parent category
- Block multiple categories from Blog
- Wrap a chosen category name with div
- Category tree is flattened inside admin upon saving
- Get woocommerce catogry
- Get last post date yesterday from each categories not work & double result post
- How do I add a function on a specific post category?
- Open subcategories in submenu on click in primary menu
- How to add Categories to the top menu of the website?
- Multiple categories PROBLEM and Duplicating main categories
- force category base – archive pages work WITH & WITHOUT category base slug in url?
- Get Unique Categories – Group By?
- Site search needs to find posts for category topic AND Tag or keyword thats not in the post
- Get category url in loop
- Previous/next post links displaying wrong category than is desired
- category url structure
- Order by category titles
- How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?
- How to let users choose posts order in categories?
- WordPress category
- Different Output for “Every Other” Foreach Statement?
- And/Or Category Query
- Show subcategories on a parent category page
- not all categories being displayed
- Category archive is displaying all posts rather than the specific category
- Use the category name instead of category slug in permalinks
- How can I display the number of post associated to a category in Twig/Timber WordPress? [closed]
- How to display the parent category if only the child category has been chosen
- Multiple Category Search with and operator in WordPress
- Display list categories from CTP
- Different CSS class by category
- Remove any product that is featured from regular display loop [WooCommerce]
- Latest updated categories list query, exclude one from displaying
- How the posts and categories connected each other in wp 4.1.1?
- Ordering categories by slug vs. name
- how can i hide category?
- Homepage custom recent news
- post_class remove tag- or category- from slug
- creating categories programmatically
- Assign a list of categories with a parent category
- Custom post type archive category page results in 404
- WP-CLI Add category as menu item main-menu
- Can’t get selected value from wp_dropdown_categories or get_categories
- Blog page with posts from specific categories
- Exclude a category and post_type from wp_query
- loop in single.php of the same category
- How to assign Categories and tags inside the TinyMCE Editor for each Image?
- outputting taxonomy hierarchy
- Make category archives page in menu non-clickable
- Why use hierarchical taxonomies instead of many custom taxonomies?
- Breadcrumbs and Categories
- Search by tag, category and author without plugin
- How to show posts only for the last subcategory?
- Hide category links if there is nothing in the categories – Main Navigation submenu item
- Create monthly archive for parent category
- Different styles for categories – need to edit a plugin
- Unable to get all tags from specific categories
- Hide all posts by an author
- Rewrite category list as an if / else statement
- Displaying just one post from each category on archive page
- Exclude categories from homepage but not from sidebar
- Exclude Specific Categories?
- Display category tree of a post in search results