Different feature box for each page

by Melvin Ram

The feature box is a cool feature of Thesis. It basically gives you a box/area to put content into. However, sometimes you want to show different content inside the feature box based on what page you’re on. You might want to have a graphic for section 1 and a different graphic for section 2.

To get this to work, you’ll first need to go into your Thesis options and set the Feature Box to show site wide.

Next, add the following code to your custom_functions.php file:

function custom_feature_box(){
 if (is_page('home')) { ?>
 <a href="blah blah blah"><img src="<?php bloginfo('template_url'); ?>/custom/images/home.jpg" alt="something" /></a>
 <?php
 }
}

add_action('thesis_hook_feature_box', 'custom_feature_box');

As you probably guessed, this lets you add an image link on your home page. If you wanted to add a second section, you’d have another if statement, like the following:

function custom_feature_box(){
 if (is_page('home')) { ?>
 <a href="services"><img src="<?php bloginfo('template_url'); ?>/custom/images/services-billboard.jpg" alt="Services" /></a>
 <?php

 }

 if (is_page('services')) { ?>
 <a href="services"><img src="<?php bloginfo('template_url'); ?>/custom/images/services-main.jpg" alt="Services" /></a>
 <?php
 }

}

add_action('thesis_hook_feature_box', 'custom_feature_box')

Leave a Comment

Spam Protection by WP-SpamFree

Previous post:

Next post: