How To Use Featured Content Gallery with Thesis and a Static Front Page

by Russell on November 24, 2009 · 12 comments

in how tos, thesis

Thesis and Featured Content Gallery Does Not Work On A Static Front Page

Out of the box there is a big problem when trying to use a Thesis Feature Box on a site with a static Home page where the Feature Box is populated using the Featured Content Gallery plugin.

The text for the home page does not display correctly. In fact, it does not display at all. Instead what is displayed is a number of teasers for the posts featured in the Featured Content Gallery plugin.

This article provides a fairly easy workaround that allows you to put a Featured Content Gallery on your static home page on a Thesis WordPress site.

Circumventing the Bug With Thesis and Featured Content Gallery

The bug which may be in Thesis, or may be in Featured Content Gallery, or may be just an incompatibility between the two means that Thesis decides to display the posts featured in the content gallery rather than the static page.

With the Thesis feature box, the code for reading the featured posts runs before the code that displays the home page. To circumvent the bug, we make the featured content gallery run after the home page display, and then use CSS to overlay the Featured Content Gallery on top of the feature box.

Overlay the Thesis Feature Box With the Featured Content Gallery

Thesis Feature Box Settings

Thesis Feature box is set up to display on only the front page as follows:

Thesis Feature Box Settings

Custom Functions for the Feature Box and the Featured Content Gallery

No code is required to be added at the ‘thesis_hook_feature_box’ as the box is empty.

The Feature Content Gallery code is executed only of the front page and the Thesis hook is ‘thesis_hook_after_footer’ which means the Featured Content Gallery code is (crucially) executed after the home page text has been displayed.


function my_featured_content(){
global $post;
if (is_front_page()) {
  include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php');
  }
}
add_action('thesis_hook_after_footer', 'my_featured_content');

If you try running at this stage then the front page will display correctly with the Featured Content Gallery beneath it. The next stage is to use CSS to make the gallery appear above the home page text.

Custom CSS settings for the Feature Box and the Featured Content Gallery

Changes to custom.css are as follows

  • Specify the required height and width of the empty feature box as a placeholder for the Featured Content Gallery
  • Use absolute positioning to overlay the Featured Content Gallery on top of the empty Feature Box
.custom #feature_box{ padding-left:0; padding-right:0; height:270px; width:985px; }
.custom #featured{ position:absolute; top:178px; }

Of course you will need to set height, width and top according to the size of your slideshow images and the depth of your header. In this example the slideshow images were 985 by 270 pixels and the header depth was 178 pixels.

Overlaid Featured Content Gallery on a Static Home Page

It looked like this:

Example of Featured Content Gallery on Static Home Page under Thesis

{ 12 comments… read them below or add one }

Donna Payne, The Web Coach December 14, 2009 at 1:23 pm

Thanks for writing this tutorial – it clarified some questions that my client and I had. Woohoo! I love Thesis.
.-= Donna Payne, The Web Coach´s last blog ..Web Coach Tip: Top 10 Deadly Web Site Design And Copy Mistakes for 2010 =-.

kcortez February 5, 2010 at 5:21 pm

Does this methodology work with Thesis 1.6?
.-= kcortez´s last blog ..Grace Potter and the Nocturnals in Carrabassett Valley, ME 04947 on 03/13/10 =-.

Russell February 6, 2010 at 9:04 am

Yes this does work for Thesis 1.6.

kcortez February 6, 2010 at 9:41 am

No success, but close:

http://www.goseethisband.com/?page_id=2782

I see everything there yet FCG doesn’t appear to be displaying anything. I look at the CSS and it looks ok. Any thoughts?
.-= kcortez´s last blog ..Grace Potter and the Nocturnals in Carrabassett Valley, ME 04947 on 03/13/10 =-.

Tony February 24, 2010 at 7:13 am

Thanks so much for this tutorial.

Tried it out at a site that I’m developing at http://www.ukbusinesswebsitedevelopment.co.uk

Works perfectly with Thesis 1.6.

Tony
.-= Tony´s last blog ..Testimonials =-.

David March 2, 2010 at 12:23 pm

Hi thanks for this it works perfect. I am doing a site for an artist and this worked real nice to show off images on the front page. I dont want to show any text at all on the front page. How would I get rid of the text that now appears under FCG??

Thanks again!

Russell March 2, 2010 at 2:09 pm

Hi David,

I think what you need to do is set the “Text Overlay Height in Pixels” to zero if I understand the text you are referring to.

If that does not work, please supply your URL so I can take a look

Russell

Damien December 14, 2010 at 12:21 pm

Thanks heaps mate. Was able to get it to work with your help :)
Damien´s last [type] ..FHTM Under Investigation Over Pyramid Scheme Claims

Pete February 4, 2011 at 6:21 pm

I tried using the gallery on my site but when I enable the plugin, the post pages do not load. It just shows me the homepage even for the post page.. any pointers?

Russell February 5, 2011 at 11:05 am

Pete, make sure you set the gallery to appear only on the home page.

It sounds like you might have a plugin conflict, check your page for javascript errors – this is probably easiest done using Internet explorer and looking for an error/warning symbol at the bottom of the page

rich February 22, 2011 at 3:43 am

Great solution, but I am trying to have a sidebar column along side this. Had originally had used a hook below the headline to position properly, but of course ran into the bug re static page. Your solution works great if you want the gallery to span the entire page, but have any suggestions for how it might work to have the right hand column essentially “wrap around” the gallery?

Thx much.

Regards

Russell February 24, 2011 at 10:53 am

Rich,

How have you set up the feature box?

What we are try to do here is reposition the FCG in the space created by the empty feature box.

As long as the FCG is of the right size then it should not make a difference whether it is full width or just above the content section only – the process is exactly the same

Regards

Russell

Leave a Comment

CommentLuv badge

Spam Protection by WP-SpamFree

Previous post:

Next post: