Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put add_action() in WordPress

I am new to WordPress. I was referring to code of WordPress theme. I am confused about where to put our function and add_action() for that function.

I want to know whether it is right to define function and add_action in one PHP file and put it anywhere in our theme folder.

like image 873
Kamal Avatar asked Aug 08 '13 13:08

Kamal


1 Answers

"functions.php" is the file where you want to put your custom functions, hooks and actions. If your theme doesn't have a functions.php just create it. Wordpress will get the contents of it automatically, so you will have access to defined functions anywhere in your theme.

like image 179
ninja Avatar answered Oct 04 '22 18:10

ninja