Title: Edit a Page&#039;s Code?
Last modified: August 19, 2016

---

# Edit a Page's Code?

 *  [cyberknight8610](https://wordpress.org/support/users/cyberknight8610/)
 * (@cyberknight8610)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/edit-a-pages-code/)
 * How can I edit a pages code on my website? I don’t mean to create a custom page
   but just to modify a specific one. For instance I have an ad at the top of my
   pages and post but I don’t want it on one of my pages. How do I do this?

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

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/edit-a-pages-code/#post-2047535)
 * Admin – Apearance -Editor
 *  Thread Starter [cyberknight8610](https://wordpress.org/support/users/cyberknight8610/)
 * (@cyberknight8610)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/edit-a-pages-code/#post-2047536)
 * I don’t see it for the specific page though
 *  [Sidney Harrell](https://wordpress.org/support/users/sidharrell/)
 * (@sidharrell)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/edit-a-pages-code/#post-2047539)
 * It is either being placed in the header.php file or in the template file. To 
   find out create an empty file in your theme directory and call it noad.php Add
   the following lines to it:
 *     ```
       <?php
       /*
       * Template Name: No Ad
       */
       get_header();
       ?>
       ```
   
 * Switch the page that you are interested in to the No Ad template and load the
   page. It should only load the header. If you can see the ad, then the ad is being
   placed in the header.php file. If not, then open up the template file that the
   page was using before.(and switch back to that template) Assuming that the page
   is using the default template for pages, it would be page.php in your theme directory.
   
   Find the code that is placing the ad and wrap it so:
 *     ```
       <?php if(!is_page('The title of the No Ad Page')) { ?>
       // The code placing the ad...
       <?php } ?>
       ```
   
 * If it is not the No Ad page, then the ads will be displayed. If it is the No 
   Ad page, then the ad code will be skipped. There’s a great plugin that does the
   same for widgets called widget logic.

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

The topic ‘Edit a Page's Code?’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [edit](https://wordpress.org/support/topic-tag/edit/)
 * [page](https://wordpress.org/support/topic-tag/page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Sidney Harrell](https://wordpress.org/support/users/sidharrell/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/edit-a-pages-code/#post-2047539)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
