Title: Detect URL for If statement
Last modified: August 20, 2016

---

# Detect URL for If statement

 *  [Kalman Labovitz](https://wordpress.org/support/users/ffemtkl/)
 * (@ffemtkl)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/detect-url-for-if-statement/)
 * In WordPress I would like to to show a custom header.php if the URL contains 
   a specific string (in this case /support/ also to include /support/forums/). 
   I have looked around and have tried many different combinations, but cannot seem
   to get it to work. Below is the code I have, any help would be greatly appreciated!!!
 *     ```
       if (substr($_SERVER['REQUEST_URI'], 0, 5) !== '/support') {
       get_header('drive_doc');
       } else {
       get_header();
       }
       ```
   
 * FYI… I need it to work this way (I think) because I am using custom post types
   and therefore cannot use standard WordPress calls because it is just a slug and
   not a Post/Category/.etc.
 * Thanks!!

Viewing 1 replies (of 1 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/detect-url-for-if-statement/#post-2156977)
 * is the file name of your custom header file
    `header_drive_doc.php` ?
 * That is what is required with `get_header('drive_doc');`

Viewing 1 replies (of 1 total)

The topic ‘Detect URL for If statement’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/detect-url-for-if-statement/#post-2156977)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
