Genesis Tutorials

Tips, Tricks, and How-tos for the Genesis Theme Framework

  • The Genesis Developer’s HandbookVisual Hook Guide
  • code, settings & options oh my!Resources
    • Collection Of CodeSnippets
    • Under ConstructionGenesis Functions
    • Coming Soon…Utilizing Genesis SEO Options
  • Extend GenesisPlug-ins
    • Genesis Post Teasers
    • Genesis Favicon Uploader
  • Genesis Child ThemesThemes
  • What is genesistutorials.com?About
    • Genesis Tutorials Roadmap
You are here: Home / Snippets / Set default images for categories

Set default images for categories

December 19, 2010 by Leave a Comment

add_filter('genesis_get_image','default_category_image');
function default_category_image($output) {
if ( !$output ) {
	if ( in_category('1') ) {
		$output = '<img height="150" width="200" title="default-categoryone-image" alt="default-categoryone-image" class="'alignleft post-image" src="'.get_bloginfo('stylesheet_directory').'/images/cat-thumbs/categoryone-graphic.png">';
	}
	elseif ( in_category('2') ) {
		$output = '<img height="150" width="200" title="default-categorytwo-image" alt="default-categorytwo-image" class="'alignleft post-image" src="'.get_bloginfo('stylesheet_directory').'/images/cat-thumbs/categoryone-graphic.png">';
	}
}
return $output;
}

Function Info: add_filter(), get_bloginfo(), genesis_get_image()

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Genesis Framework for WordPress

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Genesis Guide for Absolute Beginners

Click to download the Genesis Guide for Absolute Beginners

Follow me on Twitter

Follow @tweetsfromchris

Recent tutorials

Genesis 3.0.0 Removed Deprecated Functions

How to Add a Logo to the Header

Say Hello to the Genesis Visual Hook Guide v2.5

Genesis Tutorials • Built on the Genesis Theme Framework

Genesis Tutorials is not affiliated with StudioPress, and is maintained and operated by Christopher Cochran.