Title: Using if statement in Functions.php file
Last modified: August 21, 2016

---

# Using if statement in Functions.php file

 *  [Kelly Janes](https://wordpress.org/support/users/owlsheadbiz/)
 * (@owlsheadbiz)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/using-if-statement-in-functionsphp-file/)
 * I have a snippet of code that I’d like to use to generate two different outcomes.
   If the user is on page 1, I want the function to point them to the delivery page.
   If they are on the delivery page, I want the function to point them to a thank
   you page. Here is the code that points them to page 2:
 *     ```
       function app_redirect( $script ){
           return str_replace("window.location.href=app_location()", "window.location.href='http://islandfreshlaundry.com/dev/delivery/'", $script);
       }
       add_filter( 'app_footer_scripts', 'app_redirect' );
       ```
   
 * How can I modify that so that it continues to function as is on page 1, but has
   a different redirect from the delivery page?
 * Hope that makes sense…

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

 *  Thread Starter [Kelly Janes](https://wordpress.org/support/users/owlsheadbiz/)
 * (@owlsheadbiz)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/using-if-statement-in-functionsphp-file/#post-4503683)
 * I’m realizing this is not what I need to do. The function that I’m adding is 
   replacing a string somewhere in a script, which I have searched for long enough
   that I can’t see straight anymore.
 * What I need is to modify the script so that it redirects to one page in one instance
   and another page in another instance.
 * Can anyone tell me based on the code above what script I should be looking for?
   Or is that changing an instance in the database that is dynamic and there’s no
   way I can do what I want to do?
 *  Thread Starter [Kelly Janes](https://wordpress.org/support/users/owlsheadbiz/)
 * (@owlsheadbiz)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/using-if-statement-in-functionsphp-file/#post-4503764)
 * I think the guys at wpmudev are handling this. I’ll report back if the issue 
   is unresolved past this evening.

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

The topic ‘Using if statement in Functions.php file’ is closed to new replies.

## Tags

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

 * 2 replies
 * 1 participant
 * Last reply from: [Kelly Janes](https://wordpress.org/support/users/owlsheadbiz/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/using-if-statement-in-functionsphp-file/#post-4503764)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
