• Hi all,

    I’m trying to make a theme function work on only the (static) home page.

    I’ve tryed this:

    if (is_front_page()) {
    	add_streched_background(array(
    		'background' => 'http:...jpg',
    		'shuffle' => 'yes',
    		'nextSlideDelay' => '12000'
    )); }

    But that breaks the plugin. Any other suggestions?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • which plugin?

    in which context did you use the above code?

    how does the breaking of the plugin show?

    any error messages?

    Thread Starter likelythat

    (@likelythat)

    Hey alchymyth,

    Thanks for writing!

    It’s for the background stretcher plugin which uses jquery.
    I plugged the above code directly in the theme functions code (functions.php) the code works correctly without the if statement.

    When I add the if statement, I don’t receive any error, the background images just don’t show up, I tryed “is_page();” also just to make sure
    I wasn’t targeting the wrong page. I also tried reseting the query with:
    wp_reset_query();. No luck ??

    I’ve currently hacked a way to do it by removing “get_header” from page.php, and manually including all the info in header.php except for: <?php wp_head(); ?>, which is what was pulling in the plugin.
    This of course is a sloppy solution, that I’m not comfortable with, but since I’m new at WP I don’t really see any other solution since the if statement doesn’t work…

    Any suggestion?

    Thanks in advance!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using an if statement to make functions work on only one page.’ is closed to new replies.