Acabado: Adding Image Banners To Each Tag and Category

by Josh Koop | Last Updated:  August 10, 2020
Apply to Ezoic Surfer SEO 7 Day Trial Brave Browser
Pro Blogger Income is owned and operated by ProBloggerIncome.com. Pro Blogger Income is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Pro Blogger Income also participates in affiliate programs with Avantlink, Clickbank, CJ, ShareASale, and other sites. Pro Blogger Income is compensated for referring traffic and business to these companies.

When you start to build out your Acabado blog you typically are very limited on the look and feel of the entirety of your site. There was a request on how you could implement adding in a image for categories instead of just the category name.

The ability to add a little image to those category views can add a lot to your blog for very little overhead and very little setup. There is two ways to maintain this style of work, you can either do code which will allow each category to have its own image or use normal CSS to pick a single image to have behind all categories.

Example In Use

Custom Image Per Category

  1. Requires the install and activation of these two plugins:
  2. Edit your categories and select/upload your desired images.

Configure Each Category (or Tag) With An Image

  1. Click on [ Posts ]
  2. Click on [ Categories ]
  3. Scroll to Bottom Area Look For [ Image ]
  4. Upload and choose your image

Add New Code Snippet With Following Code

  1. Click On [ New Snippet ]
  2. Name: [ Pull WP Term Image ]
  3. Add Code Below: [ Copy and Paste Below Code ]
    • Everything within {style} can be changed to better fit your site.
  4. Set To [ Run Everywhere ]
function acabado_wp_term_image_url() {
  // image id is stored as term meta.
  $image_id = get_term_meta( get_queried_object_id(), 'image', true );

  // image data stored in array, second argument is which image size to retrieve.
  $image_data = wp_get_attachment_image_src( $image_id, 'full' );

  // image url is the first item in the array (aka 0).
  $image = $image_data[0];

  if ( ! empty( $image ) ) {
      return esc_url( $image );
  }
}

add_action( 'wp_head', function () { ?>
	<style>
		header.page-header {
    		background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(<?php echo acabado_wp_term_image_url() ?>);
    		background-size: cover !important;
    		padding: 70px 25px 70px 25px;
    		margin: 15px 0px 25px 0px;
		}
		
		h1.page-title {
 	   		color: #ffffff;
			margin-bottom: 0px;
		}
		
	</style>
<?php } );

Once these steps are in place you are now able to start going through and taking a look as you fine tune everything, hopefully this helps you out and allows you to add a new customization to your site!

CSS ONLY (Single Image On All Categories)

header.page-header {
    background-color: aliceblue;
    background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(https://acabadotheme.com/wp-content/uploads/2020/04/f6c098f….jpg) !important;
    background-size: cover !important;
    padding: 50px 20px 20px 50px;
    margin: 15px 0px 25px 0px;
}

h1.page-title {
    color: #ffffff;
}

Final Thoughts

I never want to just look like everyone else, this is one of the largest issues with Acabado in general, it is very plain and every site looks like a clone of others.

This is why I continue to make little tweaks so that everyone can build out a site that works for them and is visually stimulating for their visitors also. Hopefully this helps someone out, I feel it adds some nice changes to the Category pages and Tag pages.

I love technology, I have plenty of technical side experience but never really thought of blogging as a way to earn an income. With everything that has gone on in the last couple years and the instability of the job markets I started to learn how to blog and build affiliate niche sites to add more income channels to give me the chance to break free from the financial chains that bind me and find real freedom!