Title: Child function.php
Last modified: August 20, 2016

---

# Child function.php

 *  Resolved [johnupatree](https://wordpress.org/support/users/johnupatree/)
 * (@johnupatree)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/child-functionphp/)
 * Hi,
    The learning curve continues! I am trying to create a child function.php,
   I have looked at the Codex page and just need some clarification please.
 * There are two changes I wish to make to my child theme, neither radical, more
   me being fussy and also to help me understand better how things work.
 * I know how to delete the text I don’t want in the function.php file of the parent,
   however after an upgrade it obviously reverts back. I therefore want to create
   a child .php
 * The parent .php looks like this;
 *     ```
       function pinboard_current_location() {
       	global $pinboard_page_template;
       	if ( ! ( is_home() && ! is_paged() ) && ! is_singular() || isset( $pinboard_page_template ) ) {
       		if( is_author() )
       			$archive = 'author';
       		elseif( is_category() || is_tag() ) {
       			$archive = get_queried_object()->taxonomy;
       			$archive = str_replace( 'post_', '', $archive );
       		} else
       			$archive = ''; ?>
       		<hgroup id="current-location">
       			<h6 class="prefix-text"><?php _e( 'Currently browsing', 'pinboard' ); ?> <?php echo $archive;
       ```
   
 * The text I wish to remove is on the last two lines; ‘Currently Browsing’
 * How much/little of the above code do I need to put into the child .php?
 * Finally, on the Codex page it says I can declare conditionally, it gives this
   as an example.
 *     ```
       if ( ! function_exists( 'theme_special_nav' ) ) {
           function theme_special_nav() {
               //  Do something.
           }
       }
       ```
   
 * Is this relevant for the following addition I wish to make;
 *     ```
       function replace_howdy( $wp_admin_bar ) {
        $my_account=$wp_admin_bar->get_node('my-account');
        $newtitle = str_replace( 'Howdy,', 'Hello', $my_account->title );
        $wp_admin_bar->add_node( array(
        'id' => 'my-account',
        'title' => $newtitle,
        ) );
        }
        add_filter( 'admin_bar_menu', 'replace_howdy',25 );
       ```
   
 * _[Please post code & markup between backticks or use the code button. Your posted
   code may now have been permanently damaged by the forum’s parser.]_
 * If so what would I replace the ‘theme_special_nav’ with, or have I got that totally
   wrong?
 * Long query I know, sorry. I am trying to find a local ‘buddy’ to mentor me on
   things WordPress!
 * Cheers
 * John

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

 *  Thread Starter [johnupatree](https://wordpress.org/support/users/johnupatree/)
 * (@johnupatree)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/child-functionphp/#post-3526906)
 * OK, I have had a play, think I may have guessed the answer to my conditionality
   question, however I now have another issue!
    When I upload the .php file I cannot
   access my site OR the admin. Once I delete the Child .php normality is restored.
   Any suggestions welcome.
 * My Child functions.php looks like this;
 *     ```
       <?php
   
       if ( ! function_exists( 'pinboard_current_location' ) ) {
           function pinboard_current_location() {
               //  Do something.
           }
       }
       if ( ! function_exists( 'pinboard_current_location' ) ) :
       /**
        * Highlight current location in the archive
        *
        * @since Pinboard 1.0
        */
       function pinboard_current_location() {
       	global $pinboard_page_template;
       	if ( ! ( is_home() && ! is_paged() ) && ! is_singular() || isset( $pinboard_page_template ) ) {
       		if( is_author() )
       			$archive = 'author';
       		elseif( is_category() || is_tag() ) {
       			$archive = get_queried_object()->taxonomy;
       			$archive = str_replace( 'post_', '', $archive );
       		} else
       			$archive = ''; ?>
       		<hgroup id="current-location">
       			<h6 class="prefix-text"><?php _e( 'pinboard' ); ?> <?php echo $archive; ?></h6>
       			<<?php pinboard_title_tag( 'location' ); ?> class="page-title">
       				<?php if( isset( $pinboard_page_template ) ) {
       					echo the_title();
       				} elseif( is_search() ) {
       					__( 'Search results for', 'pinboard' ) . ': "' .  get_search_query() . '"';
       				} elseif( is_author() ) {
       					$author = get_userdata( get_query_var( 'author' ) );
       					echo $author->display_name;
       				} elseif ( is_year() ) {
       					echo get_query_var( 'year' );
       				} elseif ( is_month() ) {
       					echo get_the_time( 'F Y' );
       				} elseif ( is_day() ) {
       					echo get_the_time( 'F j, Y' );
       				} else {
       					single_term_title( '' );
       				}
       				if( is_paged() ) {
       					global $page, $paged;
       					if( ! is_home() )
       						echo ', ';
       					echo sprintf( __( 'Page %d', 'pinboard' ), get_query_var( 'paged' ) );
       				}
       				?>
       			</<?php pinboard_title_tag( 'location' ); ?>>
       			<?php if( is_category() || is_tag() || is_tax() ) : ?>
       				<div class="category-description">
       					<?php echo term_description(); ?>
       				</div>
       			<?php endif; ?>
       		</hgroup>
       		<?php
       	}
       }
   
       function replace_howdy( $wp_admin_bar ) {
        $my_account=$wp_admin_bar->get_node('my-account');
        $newtitle = str_replace( 'Howdy,', 'Greetings from the far side', $my_account->title );
        $wp_admin_bar->add_node( array(
        'id' => 'my-account',
        'title' => $newtitle,
        ) );
        }
        add_filter( 'admin_bar_menu', 'replace_howdy',25 );
   
        ?>
       ```
   
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/child-functionphp/#post-3526940)
 * I do not know whether this is true for all themes, but with Twenty Twelve you
   leave the original functions.php alone and only put additions or changes (do 
   not copy the original) in a supplementary functions.php file in your Child Theme
   folder.
 *  Thread Starter [johnupatree](https://wordpress.org/support/users/johnupatree/)
 * (@johnupatree)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/child-functionphp/#post-3526961)
 * Thatisexactly what I have done. Left the original alone, not copied it but created
   a new one. It is I the child directory along with a (working as required) child
   style.css
 *  Thread Starter [johnupatree](https://wordpress.org/support/users/johnupatree/)
 * (@johnupatree)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/child-functionphp/#post-3527066)
 * Gone back to the drawing board. Will spend more time reading before I go any 
   further!

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

The topic ‘Child function.php’ is closed to new replies.

## Tags

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

 * 4 replies
 * 2 participants
 * Last reply from: [johnupatree](https://wordpress.org/support/users/johnupatree/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/child-functionphp/#post-3527066)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
