0

New to WordPress. Searched this site and google for an answer to this question; can't even find a mention of what theme codes are.

I'm being told by a plugin to alternatively add a line of code to my "theme codes" if I prefer, instead of using the shortcode.

What are theme codes? Is this a file? If so, where is it located?

Lastly, as a bonus question, I'm wondering if "theme codes" is an official term when using WordPress or if that's just something this this plugin made up. I have done a ton of internet searches as well as looking on many sites like stack exchange and I've found little to no mention of them.

3
  • 2
    They might just mean in your theme's functions.php hard to tell though without any other context.
    – Nick Young
    Commented May 12, 2015 at 0:01
  • I agree with @NickYoung. It's probably referring to functions.php in your theme folder. "Theme codes" is not a standard term, at least I don't think so.
    – coopersita
    Commented May 12, 2015 at 0:03
  • As a side note, I'd recommend using the standard Jetpack sharing functionality for this
    – Tom J Nowell
    Commented May 12, 2015 at 0:21

1 Answer 1

3

They're probably referring to the functions file in your theme, functions.php. This file is loaded by WordPress during setup, and gives you an opportunity to do things or register hooks and filters. Note that this file is optional, and not every theme has a functions.php, if that's the case just create one yourself

Keep in mind the only thing that's special about this file is where it is located and when it's loaded, otherwise all the code inside it is exactly the same code as in a plugin.

In a lot of cases you can copy paste the code into a new PHP file, add a comment at the top and put it in the plugins folder and vice versa. It's the same environment too, there's no special sandbox for theme code that separates it from plugin code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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