Careful, this is an important file and it will bring down your site if you do one tiny wrong thing.

Here are the very basics:

  1. Child theme: Best practice: you should always use a child theme. You should then only use the functions.php file of the child theme.
  2. Careful: One extra space or bracket or slash can break the file … and bring down your site. No, really. See #3.
  3. FTP: Check first (please … ) to see that you have FTP or some sort of editing access to the functions.php file before you start making changes to it. This could be through FTP or cPanel or anything other than WordPress. Because your WordPress admin will also be inaccessible. Honest and truly.
  4. Backup: speaking of FTP, make sure you have a backup of the functions.php file before you start editing.
  5. #3: Did you check #3 yet? If you didn’t, do you have the cell phone number of your developer? At least the login credentials for your hosting account?

Completely empty functions.php file looks like this:


I know, it’s empty.

Functions.php file without any functions in it looks like this:

<?php

?>

That means there is nothing happening. No functions being called. It’s just the opening and closing tags of the file. It’s as good as empty. Well, empty might be even safer.

Functions file with comments or notes:

<?php
    // If you put those slashes to the left of a line
    // then it won't be called or read. Just for notes. 
    // also not required. Just thought you'd like to know. 
?>

Functions file with notes and working functions:

<?php	

add_action( 'init', 'woo_custom_move_navigation', 10 );

function woo_custom_move_navigation () {
    // Remove main nav from the woo_header_after hook
    remove_action( 'woo_header_after','woo_nav', 10 );
    // Add main nav to the woo_header_inside hook
    add_action( 'woo_header_inside','woo_nav', 10 );
} // End woo_custom_move_navigation()

?>

That’s about it. Here’s a screenshot of a functions.php file:

Editing the functions.php file can be a dangerous--although powerful--operation. Careful in there!

Editing the functions.php file can be a dangerous–although powerful–operation. Careful in there!