Title: Adding php code problem
Last modified: August 30, 2016

---

# Adding php code problem

 *  Resolved [learningwpatm](https://wordpress.org/support/users/learningwpatm/)
 * (@learningwpatm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/adding-php-code-problem/)
 * Greetings!
 * I am trying to insert the slider into a div within my functions.php file. I can
   insert an image in the same spot and it works perfectly, but when i insert the
   meteor slideshow code instead i get: Parse error: syntax error, unexpected T_STRING,
   expecting ‘,’ or ‘;’ in /wp-content/themes/canvas/functions.php
 *     ```
       add_action( 'woo_content_before', 'woo_add_banner_notice' );
   
       function woo_add_banner_notice () {
   
         // Echo an alert box
         echo '
       <div class="banner_container">
   
       	<div class="banner_container_wrapper">
       		<div class="banner_box">
       			<div class="banner_box_image">
       				<?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); } ?>
       			</div>
       		</div>
       	</div>
       </div>
   
       ';
   
       } // End woo_add_banner_notice()
       ```
   
 * [https://wordpress.org/plugins/meteor-slides/](https://wordpress.org/plugins/meteor-slides/)

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

 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/adding-php-code-problem/#post-6808634)
 * This is because the slideshow function you added already has closing and opening
   PHP tags and you added it within PHP, so the your PHP is closing early.
 * Also, this function doesn’t need to be echoed, the function will already echo
   the slideshow. I wouldn’t really recommend doing multi-line echoes like that,
   it leaves more room for error and makes it harder to tell what is PHP and what
   is HTML.
 * If you added it all as PHP, with no open or close tags for this section, it should
   work:
 *     ```
       function woo_add_banner_notice () {
       	// Echo an alert box
       	echo '<div class="banner_container">';
       		echo '<div class="banner_container_wrapper">';
       			echo '<div class="banner_box">';
       				echo '<div class="banner_box_image">';
       					if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); }
       				echo '</div>';
       			echo '</div>';
       		echo '</div>';
       	echo '</div>';
       } // End woo_add_banner_notice()
       add_action( 'woo_content_before', 'woo_add_banner_notice' );
       ```
   
 *  Thread Starter [learningwpatm](https://wordpress.org/support/users/learningwpatm/)
 * (@learningwpatm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/adding-php-code-problem/#post-6808664)
 * Thanks a lot Josh!
 * If it isn’t too much trouble i have another question.
 * Is it possible to show this slideshow only on the front page and target a specific
   slideshow for example: “slideshow_2”?
 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/adding-php-code-problem/#post-6808673)
 * No problem! You can do this with [conditional tags](https://codex.wordpress.org/Conditional_Tags),
   [is_front_page](https://codex.wordpress.org/Function_Reference/is_front_page)
   will check to make sure it is the front page. And for [multiple slideshows](http://jleuze.com/plugins/meteor-slides/multiple-slideshows/)
   with Meteor Slides, you can specify one in the function parameters.
 * The end result should look like this:
 *     ```
       function woo_add_banner_notice () {
       	// Echo an alert box
       	if ( is_front_page() ) {
       		echo '<div class="banner_container">';
       			echo '<div class="banner_container_wrapper">';
       				echo '<div class="banner_box">';
       					echo '<div class="banner_box_image">';
       						if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow( "slideshow_2", "" ); }
       					echo '</div>';
       				echo '</div>';
       			echo '</div>';
       		echo '</div>';
       	}
       } // End woo_add_banner_notice()
       add_action( 'woo_content_before', 'woo_add_banner_notice' );
       ```
   

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

The topic ‘Adding php code problem’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/adding-php-code-problem/#post-6808673)
 * Status: resolved