WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a rotating images widget I want to display on my homepage. My selected homepage is a static front page I created with several other pages to make my blog look more like a website than a blog, and then I have a separate blog page. The widget does not come with shortcode. Rather it comes with something like code that I have to insert in editor in a place that will make the widget appear where I want the rotating images to appear. What I've figured out with trial and error is that when I insert the code into the page.php I can get it to show up exactly where I want it on my selected home page. The problem is that it also shows up on all the other pages except the blog page. So, what I need to do is to write some additional code telling wordpress to only show the widget on the one page. Any ideas on how to write this code?

Here is the code that comes with the widget:

<?php include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); ?>

Thanks, Jason

share|improve this question
up vote 1 down vote accepted

Try wrapping it with the is_front_page() conditional like so:

<?php if ( is_front_page() ) { include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); } ?>

Hope this helps!

share|improve this answer

If the gallery widget is a standard widget that you can drag and drop into the sidebar, as opposed to needing the php function to call it, try WordPress › Widget Logic « WordPress Plugins

share|improve this answer
wordpress.org/extend/plugins/featured-content-gallery does not extend a Widget – soulseekah Mar 29 '12 at 20:42

You can copy page.php to page-{slug}.php and add the code there.


You can try matching against get_the_ID or $post->ID directly. Using an if ... else clause.

if ( get_the_ID() == 12 )
    include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php');

This is not a Widget in the WordPress sense, by the way.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.