Title: [Plugin: Meteor Slides] Insert PHP into is_home statement
Last modified: August 20, 2016

---

# [Plugin: Meteor Slides] Insert PHP into is_home statement

 *  Resolved [databell96](https://wordpress.org/support/users/databell96/)
 * (@databell96)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/)
 * I’m trying to figure out how to inject the PHP properly for my Meteor Slides 
   plugin so it only appears on the homepage. Nowhere else. I know to use the is_home
   conditional tag. But I tried this approach and it came across as invalid:
 * `<?php if (is_home()) { if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow();}?
   >`
 * What’s the proper PHP to use in this instance?
 * [http://wordpress.org/extend/plugins/meteor-slides/](http://wordpress.org/extend/plugins/meteor-slides/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154574)
 * You were missing a second closing curly brace, if you break it down to multiple
   lines and indent it like this you can see how it needs to be structured:
 *     ```
       <?php if ( is_home() ) {
       	if ( function_exists( 'meteor_slideshow' ) ) {
       		meteor_slideshow();
       	}
       } ?>
       ```
   
 * That will load the slideshow in the blog homepage, which may or may not be your
   site’s homepage. If you are using the default WP settings and have the blog on
   the homepage that will work. If you have set a static page as your homepage you
   will need to use this instead:
 *     ```
       <?php if ( is_front_page() ) {
       	if ( function_exists( 'meteor_slideshow' ) ) {
       		meteor_slideshow();
       	}
       } ?>
       ```
   
 *  Thread Starter [databell96](https://wordpress.org/support/users/databell96/)
 * (@databell96)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154593)
 * Cool. Thanks for the support and assistance. One other quick question. I wanted
   to make sure this function is in a div and the div can’t appear unless we’re 
   on the homepage. So how would I include that?
 * Like I know this wouldn’t work:
 *     ```
       <?php if ( is_home() ) {
       	<div class="slideshow">if ( function_exists( 'meteor_slideshow' ) ) {
       		meteor_slideshow();
       	}</div>
       } ?>
       ```
   
 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154598)
 * Yes, that will work, but you can’t add the HTML right inside the PHP. You have
   to either write it as PHP using the echo function, or you have to close the PHP,
   add the HTML, and open it again. Here’s an all PHP example with the div added
   in:
 *     ```
       <?php if ( is_home() ) {
       	if ( function_exists( 'meteor_slideshow' ) ) {
       		echo '<div class="slideshow">';
       			meteor_slideshow();
       		echo '</div>';
       	}
       } ?>
       ```
   
 *  Thread Starter [databell96](https://wordpress.org/support/users/databell96/)
 * (@databell96)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154618)
 * Thanks, JLeuze! That will help me in so many ways down the road!
 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154622)
 * You’re welcome!
 *  [russell@irondogmedia.com](https://wordpress.org/support/users/russellirondogmediacom/)
 * (@russellirondogmediacom)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154661)
 * I am running the slideshow on my front page (dev site, no live available yet)
   with this conditional section
    <?php if (is_front_page()) { echo ‘<div id=”featuredSlider”
   >’; echo ‘<div id=”slideContainer”>’; if ( function_exists( ‘meteor_slideshow’)){
   meteor_slideshow(); } echo ‘</div>’; echo ‘</div>’; } ?> So, I would expect the
   slideshow functionality to only be called if it is the front page.
 * But when I go to any other page in my site, I get an error in the console saying“[
   cycle] terminating; zero elements found by selector” and it kills other jquery
   scripts that are supposed to be running on the page.
 * I traced the error back to line 58 of the jquery.cycle.all.js file and read through
   the Is your DOM ready tutorial, but I can’t seem to see the need for this error
   since this file really shouldn’t even be loading if it’s not the front page.
 * Am I missing something?
 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154662)
 * That’s not an error, just a notice. jQuery Cycle is setup to not run if there
   are no slides, that notice won’t effect any other JavaScript. If there are any
   conflicts, you should see some errors.
 * The slideshow is only loaded on whatever page or pages you add it to, but the
   scripts are loaded on all the pages. If you want to load the slideshow scripts
   on just the homepage, you can [do it like this](http://wordpress.org/support/topic/meteor-slides-load-cssscripts-only-on-home-page?replies=2#post-2159715).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: Meteor Slides] Insert PHP into is_home statement’ is closed 
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/meteor-slides_0f131a.svg)
 * [Meteor Slides](https://wordpress.org/plugins/meteor-slides/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/meteor-slides/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/meteor-slides/)
 * [Active Topics](https://wordpress.org/support/plugin/meteor-slides/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meteor-slides/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meteor-slides/reviews/)

## Tags

 * [conditional tags](https://wordpress.org/support/topic-tag/conditional-tags/)
 * [is_home](https://wordpress.org/support/topic-tag/is_home/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 7 replies
 * 3 participants
 * Last reply from: [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-meteor-slides-insert-php-into-is_home-statement/#post-3154662)
 * Status: resolved