Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Where to Add the Custom Menu Field Code0:51 with Zac Gordon
In this video we talk about the pros and cons of placing custom menu code in a theme versus a plugin.
When it comes to adding custom fields to menu items at WordPress,
there are two different approaches that we could take.
We could add the code into our theme functions.php file or
we can create a stand alone plugin.
If we include the code in our themefunctions.php file,
the custom menu items will only appear if someone has our theme installed.
This is okay if we know the theme will never change or
the menu customization wouldn't really apply to other themes.
However, if you think users will change themes and
still need the custom menu options, then you'll want to pull out the functionality
and add it as a stand alone plugin.
Since we're really just working to further customize a theme in this example,
we'll add the code to our themefunctions.php file.
You need to sign up for Treehouse in order to download course files.Sign up