Title: How to add codes in function.php?
Last modified: August 20, 2016

---

# How to add codes in function.php?

 *  [sumonism](https://wordpress.org/support/users/sumonism/)
 * (@sumonism)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/)
 * When I started customizing my wordpress, I always used the google search as my
   first weapon. Every time I found some order to add some codes in my function.
   php file. I tried several time. But I couldn’t do it. Can any one please please&
   please tell me how to add a code successfully in my function.php. I’ll be grateful..

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

 *  [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/#post-2353050)
 * I assume you want to edit the functions.php file for your theme?
 * There are two ways to do this:
 * Go to your WordPress dashboard (www.yoursite.com/wp-admin).
    Navigate to Appearance
   >> Editor. Choose the theme you want to edit from the dropdown and the file from
   the right sidebar. (This method will only work if your WordPress files are writeable(
   [http://codex.wordpress.org/Changing_File_Permissions](http://codex.wordpress.org/Changing_File_Permissions)).
 * **OR**
 * Use your favourite FTP manager to access the location of your WordPress files.
   Navigate to `wp-content/themes/`_your-theme_.
    Open up the `functions.php` file
   and edit to your heart’s content!
 * The above methods will only work if your theme includes a functions.php file.
   If no file exists in the `wp-content/themes/`_your-theme_ directory, then create
   it.
 *  Thread Starter [sumonism](https://wordpress.org/support/users/sumonism/)
 * (@sumonism)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/#post-2353277)
 * Thanks. Where to find I know, but where to add code in the file? Just give me
   the example.
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/#post-2353281)
 * anywhere….
 * Your functions.php must start with an opening php tag, looks like:
 *     ```
       <?php
       ```
   
 * That’s really the only rule. I just add code underneath any existing code. Things
   don’t have to be in a particular order.
 * You must also not ‘nest’ php tags…. so if you copy/paste code don’t accisdentally
   put in anotehr opening php tag… like:
 *     ```
       <?php
   
       existing code
   
       <?php
   
       new code you pasted
   
       ?>
       ```
   
 * That’s about all the generic help I can give… what specific trouble are you having?
 *  Thread Starter [sumonism](https://wordpress.org/support/users/sumonism/)
 * (@sumonism)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/#post-2353287)
 * I understand a little bit. Now I am specifically telling you about my problem
   Mr. Voodoo-
 * I want to put the following code in my function.php
 *     ```
       //hook the administrative header output
       add_action('admin_head', 'my_custom_logo');
   
       function my_custom_logo() {
       echo '
       <style type="text/css">
       #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.gif) !important; }
       </style>
       ';
       }
       ```
   
 * Please show me like you show in your recent post Mr. Voodoo. Thanks..
 * _[Please post code snippets between backticks or use the code button.]_
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/#post-2353290)
 * You should be able to just paste that code in your themes functions.php file.
 * Does it already have an existing functions.php file in it?
 * You can paste it right at the bottom.
 * If you have a closing php tag, it goes above that
 *     ```
       <?php
   
       existing code
   
       your new code
   
       ?>
       ```
   
 * If it does not have a closing php tag, that is fine as well. They are not needed
   there, I never have one

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

The topic ‘How to add codes in function.php?’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 5 replies
 * 3 participants
 * Last reply from: [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-codes-in-functionphp/#post-2353290)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
