I thought out readings this week were very helpful, especially because I actually understood some of the concepts on first glance without having to Google search every other word in the document. A few terms that I did struggle with a bit were as follows:
- WP_DEBUG – When I first read through the instructions, I understood how to turn this on and off the debugging feature from the instructions provided, but did not understand what that would show on the site? Does this show you errors in your code on Sublime or in WordPress? I know we’ve spoken about debugging and checking errors in your code before, but I’m still a bit confused about how you open the code, check the code, understand the error messages, etc. I really appreciate the second portion of the document that explained how to display the error message in a clear, director manner. Although I still struggle a bit to understand what the bug lingo means (e.g. “call_user_func_array() expects parameter 1 to be valid” is not a clear description of the problem to me, whereas something like “the code is missing a bracket” would be very helpful).
- The section on WordPress templates was a bit confusing to me. Based on our discussion last week, I thought we should only be adding content to the “wp-content” folder and then if we having something that is functional (e.g. PHP or jQuery) it should go in the plugins folder but then something that is more design based should go into themes. According to the reading, however, the header, footer, sidebar, etc. themes that you may want to add should end in .php – so wouldn’t that mean they belong in the plug-in folder? If it’s a template, it’s a design feature, but when why is it built with a function code?
- Was the “Custom Fields” reading basically describing when you scroll over an “email” form on a website and it drops down the 3 or 4 emails you have used on that account? And in that scenario, the “key” would be the email field and then the value, or values, is the 3 or 4 email addresses the computer has saved from previous entries? The example made sense, but I was struggling to understand when you would use it in a practical sense as you are likely not going to put “Currently Reading” and “Today’s Mood” into custom fields on a regular basis.
- Lastly, if we have time I would like to go over how to “enqueue the parent and child theme stylesheets.” I read through the description several times, and if it’s simply copying the code, as with adding a link to a style.css sheet in HTML, then I can copy the code, but I was unclear if there are certain labels/titles/lines that need to match the code I write.
1. WP_DEBUG is a variable that can be enabled or disabled. Because we’re working with PHP, everything has to be executed by a server for it to be evaluated or run, so this would appear in your browser and not Sublime.
2. Yes, we only add code to the wp-content folder as either themes, child themes or plugins. Even though they’re generally thought of from a design perspective, themes include PHP files to act as templates — header, footer, sidebar, etc. — and then are styled by CSS. You can also have Javascript or jQuery in a theme. Overall, the distinction between a theme and a plugin is definitely about what purpose it serves rather than the kind of code it contains.
3. I think you’re partly describing the autocomplete feature of your browser (e.g. when you click in an email field and it gives you options you’ve previously entered in email fields). A custom field is something that is set in wp-admin and can then be displayed on the site or is set in the admin, submitted by a user and then displayed on the site or not. As for the kev-value question, yes — the field name is the key (email) and the value is the specific email address entered.
4. Yes, we can go over enqueueing and, correct, it’s mostly a matter of copying and modifying the example.