Posts: 1,127
Threads: 136
Joined: Feb 2012
From the Wiki:
Quote:Add the file /path/to/getsimple/theme/your-theme/functions.php into your theme to add custom functions that can be used within your theme.
Can someone explain that to me please?
Where do you get this file? What are these custom functions? Do I have to write it myself?
Posts: 161
Threads: 6
Joined: Jan 2010
It's simply an optional file a theme author might like to include with any custom functionality for that theme. Whether you (as a theme author) include a file called functions.php and what it contains is up to you.
Posts: 79
Threads: 2
Joined: Feb 2012
Timbow Wrote:From the Wiki:
Where do you get this file? What are these custom functions? Do I have to write it myself?
I think you will find a good overview on the 'function.php' file by reading this addendum to my tutorial on outlining.
http://eatons.net/tutorials/innovationoutline/addendum/
Posts: 1,127
Threads: 136
Joined: Feb 2012
Thanks. I am working my way through the free php course here:
http://www.homeandlearn.co.uk/php/php.html
When I have got through it I will take another look at functions.php .
Posts: 166
Threads: 24
Joined: Jul 2012
Sorry to bump this back up.
I'm trying ot add my scripts in the function.php but am having a bit of a fuss getting it to work.
Here is what I have so far. I kind of like working this way instead of adding them directly into the template.
PHP Code:
function add_scripts() {
echo "<script src='". get_theme_url() . "/js/utility.js'></script>";
}
add_action('theme-header','add_scripts');
Yeh...not working. It prints out the url but not in the script tag.
Posts: 3,491
Threads: 106
Joined: Mar 2010
(2013-10-10, 12:31:31)lnickel Wrote: PHP Code:
function add_scripts() {
echo "<script src='". get_theme_url() . "/js/utility.js'></script>";
}
add_action('theme-header','add_scripts');
Yeh...not working. It prints out the url but not in the script tag.
Replace
get_theme_url() by
get_theme_url(false) to return the value instead of echoing it.
Posts: 166
Threads: 24
Joined: Jul 2012
One step at a time!! LOL!!! thanks Carlos!!! Little by little I'll get the hang of it!!