WordPress add functions – safe method  [ 49 views ]

Goal: add own functions to the wordpress site

Forget the functions.php! Frankly this is working only until the next update :(.

My way is to create a totally separated file with the added functions:
1. Let’s create a new file functions_added.php

<?php
function fnc_001( $param, ... ) {
...
}
...
function fnc_nnn( $param, ... ) {
...
}

Never put php close tag ?> to the end of the file!

2. Put this file into the theme main directory.

3. Link this file to the theme header.php file. Add the following to the start of the header file.

<?php
require (get_template_directory() . '/' . 'functions_added.php' );
?><!DOCTYPE html...

This is it. All my new functions are in a safe place now.

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }