We are a group of 4 who is making a website for a school project. One of the criterias was that we had to script our own theme from scratch. Since we had no experience or knowledge of scripting we followed tutorials we found. The theme kind of works but we are missing most of the basic wordpress functions. We have tried to add the functions.php to our theme, because we did not have it, but we either didn't get any changes or the website crashed.

We can't find a way to make this work and we would love to get some help.

Link to all our scripts: https://gist.github.com/anonymous/8a9f44a2218f1e40ec2d760d15b608f0

  • 1
    You want to know how to add functions.php in theme? – BlueSuiter Apr 28 '17 at 8:29
  • We want to know how to add all the basic wordpress functions to our theme without the site crashing. – Sik Reviews Apr 28 '17 at 8:37
  • What do you mean that you tried yo add thefunction.php to your theme? You create a new file called function.php in your theme folder or you copied the wp-includes/function.php in your theme? – Laxmana Apr 28 '17 at 8:37
  • We tried both @Laxmana. Nothing worked. – Sik Reviews Apr 28 '17 at 8:38
  • 1
    But you already have it :) You can read the code of Twenty Seventeen theme to get ideas. I think you misunderstand the concept of function.php. The purpose of this file is to write your own code (functios, add hooks & filters etc). The WordPress functions are already available. WordPress read the file and "execute" the code inside that file. It's up to you what that file will contain depending what you need to do. – Laxmana Apr 28 '17 at 8:56

Using functions.php Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

In that way, the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme. Say that you want to add a PHP function to your theme. The fastest way would be to open its functions.php file and put the function there. But that’s not smart: The next time your theme is updated, your function will disappear. But there is an alternative way which is the smart way: you can create a child theme, add a functions.php file in it, and add your function to that file. The function will do the exact same job from there too, with the advantage that it will not be affected by future updates of the parent theme. Do not copy the full content of functions.php of the parent theme into functions.php in the child theme.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.