Title: Using A Case Switch for Headers
Last modified: August 19, 2016

---

# Using A Case Switch for Headers

 *  [RUBYHAUS](https://wordpress.org/support/users/rubyhaus/)
 * (@rubyhaus)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/using-a-case-switch-for-headers/)
 * I’m trying to use an old switch I used before, but am confused as to why it’s
   not working? I have a different Permalink Structure. %Post_Id%/%Postname% I’m
   wondering if I need to re-write the switch to pull Postnames instead. As the 
   switch currently only shows the default image.
 * Would anyone be willing to help me solve this riddle. Normally this would work
   if the URL had a Post Id displayed in the URL bar in the browser.
 *     ```
       <? switch( $_GET['post_id'] ) {
   
       case 19:
       $image_url = 'http://greenecountyohio.org/wordpress/wp-content/themes/greenecountyohio/images/jpg/military_header.jpg';
       break;
   
       default:
       $image_url = 'http://greenecountyohio.org/wordpress/wp-content/themes/greenecountyohio/images/jpg/where_to_header.jpg';
       }
       ?>
       ```
   
 * I’m thinking something like this would have worked but it does not seem to do
   the trick. Changing the last thing in the URL that it’s looking for. the post_id
   to postname instead. and having the case search for a name rather a number.
 *     ```
       <? switch( $_GET['postname'] ) {
   
       case "military":
       $image_url = 'http://greenecountyohio.org/wordpress/wp-content/themes/greenecountyohio/images/jpg/military_header.jpg';
       break;
   
       default:
       $image_url = 'http://greenecountyohio.org/wordpress/wp-content/themes/greenecountyohio/images/jpg/where_to_header.jpg';
       }
       ?>
       ```
   
 * Any thoughts as to what I might be doing wrong??

The topic ‘Using A Case Switch for Headers’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [RUBYHAUS](https://wordpress.org/support/users/rubyhaus/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/using-a-case-switch-for-headers/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
