Title: Modify PHP in child theme?
Last modified: August 21, 2016

---

# Modify PHP in child theme?

 *  Resolved [Foliferous](https://wordpress.org/support/users/revs/)
 * (@revs)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/modify-php-in-child-theme/)
 * Hello!
 * Well, I’m trying to change some piece of PHP code, but I’m having some problems.
   I’m trying to change the “home” link to something else basically. This is the
   piece of code, found in **functions.php**:
 *     ```
       function twentytwelve_page_menu_args( $args ) {
       	if ( ! isset( $args['show_home'] ) )
       		$args['show_home'] = true;
       	return $args;
       }
       ```
   
 * I am trying to do it the correct way, so I created another functions.php file
   in my child theme, and I pasted the code above in there (with <?php and ?> at
   the beginning and at the end of the file). But sadly, it won’t work… all pages
   turn blank.
 * I’ve tried it with a different code, the one found under [this page](http://codex.wordpress.org/Child_Themes)
   under the functions.php paragraph. I used the piece of code for the favicon to
   test it, and it worked — I have a favicon now.
 * Why does the other one not work? I first supposed it is because the piece of 
   code for the favicon isn’t found in functions.php in the first place, and so 
   they don’t “clash”, but I thought you should’t modify any of the parent themes?
 * All help much appreciated 🙂

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

 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/modify-php-in-child-theme/#post-3799710)
 * Please enable `WP_DEBUG`, and report the **fatal error** you’re getting.
 * Also, please post relevant code from your child Theme `functions.php`.
 * My guess, though, is that you’ve named the function in the child Theme the same
   as the function in the parent Theme.
 *  Thread Starter [Foliferous](https://wordpress.org/support/users/revs/)
 * (@revs)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/modify-php-in-child-theme/#post-3799791)
 * Oh, I didn’t know they shouldn’t have the same name.
 * I renamed the function into something else, it still doesn’t work but I have 
   no error anymore and the page appears normally now!
 * Here’s my child theme code:
 *     ```
       <?php
   
       // ———— FAVICON ———— 
   
       function favicon_link() {
           echo '<link rel="shortcut icon" type="image/x-icon" href="icons/favicon.png" />' . "\n";
       }
       add_action( 'wp_head', 'favicon_link' );
   
       // ———— STARTSEITEN LINK ———— 
   
       function sommer2013_page_menu_args( $args ) {
       	if ( ! isset( $args['show_home'] ) )
       		$args['show_home'] = Startseite;
       	return $args;
       }
   
       ?>
       ```
   
 * Where you see “Startseite”, this is meant to replace “Home” on the main page.
   I’ve found this way of doing it somewhere on here. It worked fine when I was 
   changing that in function.php of the parent theme.
 *  Thread Starter [Foliferous](https://wordpress.org/support/users/revs/)
 * (@revs)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/modify-php-in-child-theme/#post-3799797)
 * SORRY! It works 🙂
 * I forgot a piece of code… thanks for the help, that was the solution! I need 
   to rename them into something different!

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

The topic ‘Modify PHP in child theme?’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [Foliferous](https://wordpress.org/support/users/revs/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/modify-php-in-child-theme/#post-3799797)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
