Header image for blog category index page

My site: www.5x5advisory.com

I would like to add a custom banner image and text description to the top of my blog category index page. I’m using two different categories to create the appearance of two different blogs on my site, as described here: https://bobwp.com/how-to-easily-add-two-blogs-to-a-single-wordpress-site/. Once I get some articles posted for the second category, I’d ideally like to have each category have it’s own header image and text description,

Thanks for any help you can give.

Hi @lancesalyers,

Thanks for writing in.

You mean as a banner instead of header? You could do that as hooks, please check this thread https://theme.co/apex/forum/t/text-on-top-of-categorys-archive/33877/14

Instead of like this,

if ( is_category() || x_is_portfolio_category() || x_is_product_category() ) : ?>

You can have it like,

if ( is_category( 763 ) ) : ?>

Where the 763 is the category ID where you wish to display it, here are another sample

 if ( is_category( 763) ) : ?>
 		<?php 
 		 	$meta  = x_get_taxonomy_meta();
      		$title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Category Archive', '__x__' );
 		?>
		<header class="x-header-landmark x-container max width">
		    <h1 class="h-landmark"><span><?php echo $title; ?></span></h1>
                    <p class="p-landmark-sub"><span><?php echo category_description(); ?></span></p>
		</header>
<?php endif; 

 if ( is_category( 764) ) : ?>
 		<?php 
 		 	$meta  = x_get_taxonomy_meta();
      		$title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Category Archive', '__x__' );
 		?>
		<header class="x-header-landmark x-container max width">
		    <h1 class="h-landmark"><span><?php echo $title; ?></span></h1>
                    <p class="p-landmark-sub"><span><?php echo category_description(); ?></span></p>
		</header>
<?php endif; 

Where you display different header/banner for each category page that matches the ID.

Thanks!

Hi Rad … any suggestions on how I can manually add this code and upload it via SFTP? I keep getting this error message when I try using the WP dashboard editor:

Hello @lancesalyers,

Thanks for updating the thread.

I suggest you to use FTP programs like Filezilla and under /wp-content/themes/pro-child/ and edit the function.php file. You can refer following tutorial to get started with Filezilla.

  1. Download Filezilla from here: https://filezilla-project.org/
  2. Tutorial link: https://www.tipsandtricks-hq.com/how-to-use-filezilla-with-wordpress-8956

Thanks.

Thanks Prasant. Sorry, I should’ve been more precise. I know how to FTP the file, but what I’m unclear on is where precisely I should add the code into the function.php file. I’ve never worked with the php files themselves, only the WP editor.

Hi There,

You can add your custom function, either after the line:

// Additional Functions
// =============================================================================

Or at the bottom of your functions.php file.

Always do your template/function edits via FTP so you can correct/remove it immediately when you did a mistake, unlike on the WP editor where you can be locked out.

Thanks,

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.