Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialZac Gordon
Treehouse Guest TeacherWordPress Plugin Development Course IS LIVE! - Post feedback and questions here
This course covers how to build WordPress plugins. You should know PHP and how to build WordPress themes to complete this course.
Heres' the link to the course, enjoy! - http://teamtreehouse.com/library/how-to-build-a-wordpress-plugin
PLEASE POST any feedback or issues you have TO THIS POST :) thanks you!
26 Answers
Zac Gordon
Treehouse Guest TeacherIf you've been having trouble with FILL IN THE BLANK questions, it's my fault!!! I incorrectly entered in the options into our quiz engine. They should all be fixed now, but ping me if you think you found any I missed!
Fabian Raschke
2,908 PointsHi Zac,
I am not getting the CRUD quiz (1) to validate. Here are my two answers which I think are correct:
To write to and update our plugin information in the database we use the update_option() function
In order to get information from the options table, we use the get_option() function
May you have a look, please?
Zac Gordon
Treehouse Guest TeacherThere was a bug with this, please try again!
Swati Das
11,155 PointsTo write to and update our plugin information in the database we use the "update_option" function In order to get information from the options table, we use the "get_option" function
Cristian Cereseto
9,627 PointsHi Zac, i'm having problem with the CRUD with the options table challenge, in the 3rd question "Since ___ are not a recognized MySQL datatype, WordPress ____ them when storing them when writing to the database." my answers are "arrays" and "serialize" wich i think is correct. Could it be a bug? or am i mistaken? Thanks!
Steve Hamilton
49,986 PointsEDIT: Gave correct answer
Zac Gordon
Treehouse Guest TeacherYup, just a matter of grammar. Let's try not to give direct answers though, and more general suggestions at what's wrong.
Leopold Španovič
10,667 PointsI also stuck with at this question. I know that answer is arrays and serialize but I keep getting wrong answer reply. Because english not my native language I'm having trouble to figure out correct grammar. Can you help.
Matt Campbell
9,767 PointsYES AWESOME WICKED.....:D :D :D!!!! I am very excited.
David Darke
3,221 PointsHi, I've a problem with the Code Challenge 2 : "Using the JSON feed in the comments and the existing loop, echo out each of the course names inside list items." I tried :
echo $my_plugin_profile -> {"courses"}[$i] -> {"name"};
I think it's correct, but it doesn't work ? Cheers
Zac Gordon
Treehouse Guest TeacherMake sure that you're also using the correct HTML inside of the loop.
naz
857 PointsGenerally I thought it was really good, the JSON part tired me out a bit though :-)
Cristian Cereseto
9,627 Pointsups! thank you so much!
Wendi Adistya
3,671 Pointsi have the same trouble with CRUD challenge ( Since ___ are not a recognized MySQL datatype, WordPress ____ them when storing them when writing to the database ) i have try many times and still uncorrect. any clue?
Alexandra Spalato
11,478 PointsHi, i'm very ineterested in following this course, i wanted to know which level i need in php, i'm really basic, but i am following how to build a wp theme, and it's ok for me (i understand loops etc..). So i wanted to know if that's enough, or have i to follow before the course about php ? (i have follow a long course about php but not here, and as i don't practice....) I'm really focus and specialized on wp, i actually build templates from scratch with a framework (ultimatum ) and want now to really learn to create from scratch, and why not plugins :-)
Zac Gordon
Treehouse Guest TeacherI would suggest working through the advanced PHP as well since we don't explain any PHP use, just use it.
That said, if you at least know what's covered in the basic PHP courses, then go for it and study up as you go along :)
Paul Graham
1,396 PointsYou should follow the course on PHP because you're going to be getting into actual PHP programming quickly when dealing with plugins. You'll still be using a lot of the WP API but you'll also need to directly interface with the server or database at times.
Alexandra Spalato
11,478 PointsOk, so i will go for the PHP course!
Fabian Raschke
2,908 PointsI thought I found a bug but it was just me being wrong... :-)
Fabian Raschke
2,908 PointsI have another issue, at the JSON Code Challenge Task 2. My solution doesn't validate although I think it's correct:
{
"users": {
"First Name": "Mike",
"Last Name": "the Frog"
}
}
David Darke
3,221 PointsEDIT: Gave correct answer
Fabian Raschke
2,908 PointsThanks for helping out!
Zac Gordon
Treehouse Guest TeacherDavid Darke a better answer might have been, make sure that you're including the new user inside of an array rather than just listing the object. Again, trying to avoid posting direct answers ;)
Ben Ackles
27,551 PointsCan anyone see what's wrong with my code? I'm working on the 3rd Objective of the section "Creating a Plugin Setting Page".
Here are the instructions:
Create the function called in the add_options_page() function. Inside of it echo out "Welcome to my plugin settings page."
Here's my code:
<?php
function my_plugin_menu() {
// Page Title: My Plugin Settings Page
// Menu Title: My Plugin
// Slug: Same as menu name, but with hyphens instead of spaces
// Make sure user has ability to manage plugin options
// my_plugin_options_page() is the function for what displays on the options page
add_options_page(
'My Plugin Settings Page',
'My Plugin',
'manage_options',
'my-plugin',
'my_plugin_options_page'
);
}
add_action('admin_menu','my_plugin_menu');
function add_options_page() {
echo 'Welcome to my plugin settings page.';
}
?>
Zac Gordon
Treehouse Guest TeacherYou need to check that all of your functions and callback functions have the correct names.
Felix lim
6,049 Pointsdoesn't works for me either. Please advise, here is my code below :
function my_plugin_options_page() {
if( function_exists( 'my_plugin_menu' ) ) {
echo "Welcome to my plugin settings page.";
}
}
Van Doan
32,285 PointsGood grief!!! I spent half an hour toying with this. Go back to the original example by Ben Ackles above. Then, you have to rework the name of the function. Hint: look at the comments inside the code.
David Darke
3,221 PointsHi Zac, I have a problem with the second task in "Adding ajax to plugins on the frontend" I tried this: wp_enqueue_style('my_plugin_frontend_css', plugins_url( 'front-end.css' ) ); But I get the following error: "Bummer Make sour You have used the proper CSS file path and name!.". Cheers
Jill Molloy
6,920 Pointssame problem here...
Steve Hamilton
49,986 PointsI am having the same issue. I also posted the same issue below.
Zac Gordon
Treehouse Guest TeacherYou have to check that you're giving the url of the plugin folder as well.
Greg Galus
13,228 PointsI was also stuck on this for a while. The folder name is not specified in the question. I had to kind of guess what the folder may be until I finally got a correct answer. Unless I missed something somewhere.
Ben Ackles
27,551 PointsNevermind. I was calling the wrong function.
Robert Evans
2,386 PointsI'm on the adding settings to the widget video. I went to download the zip and it's empty
Zac Gordon
Treehouse Guest TeacherPlease try again, should work now!
Jill Molloy
6,920 PointsDave - I guess you're supposed to know that the css file is located in the "my-plugin/css" folder - no indication of this at all in the challenge.
Steve Hamilton
49,986 PointsThank you for this comment, I was stuck on the task waiting for a response. This is a bad assumption on their part, to assume we know the project directory name and the fact that they had a css directory.
Zac Gordon
Treehouse Guest TeacherJill Molloy could you point me to the URL for this. We've been making a lot of patches, but i want to double check this is fixed. Thanks!
Jill Molloy
6,920 PointsHi Zac Gordon - apologies, it's a couple of weeks since I took the challenge and I don't remember off the top of my head. The challenge was the one Dave mentioned above - task 2 of "Adding ajax to plugins on the frontend"
Hope that helps... many thanks for your efforts with the course, it's exactly what I was looking for.
Zac Gordon
Treehouse Guest TeacherNo problem, we've made a bunch of tweaks and fixes, so let me know if you run across any other problems. Cheers :)
Steve Hamilton
49,986 PointsZac,
The following Code Challenge has an issue in task two:
http://teamtreehouse.com/library/adding-ajax-to-plugins-on-the-frontend
"Inside of the my_plugin_frontend_scripts function, enque a stylesheet named front-end.css with a handle of my_plugin_frontend_css"
It tells us to use wp_enqueue_style() with plugins_url(). I have used them but it keeps complaining about the exact path to the css file. Is there some subpath that it is expecting that is not mentioned in the step. I have tried the following, but it doesn't work:
wp_enqueue_style('my_plugin_frontend_css', plugins_url('front-end.css'));
I even tried the following, thinking that the quiz project was called my-plugin:
wp_enqueue_style('my_plugin_frontend_css', plugins_url('my-plugin/front-end.css'));
Steve Hamilton
49,986 PointsFound the fix in the comment above. They need to be more descriptive, of the test project directory structure.
Zac Gordon
Treehouse Guest TeacherSteve Hamilton correct. We're fixing now!
Preston Davis
5,932 PointsThe files referenced in this course are apparently not in the zip file. No CSS, Neither are there any of the additional PHP files referenced in the course.
To use your phrase: "BUMMER!" - as now I have to stop and ....wait.
Please advise
Preston
Update: After jumping ahead in the course and downloading the files (zip) I WAS able to find the CSS file.
Yann Fageol
7,431 PointsHi, A small review, i found this project was way harder than the previous ones especially from the 4th chapter,
Some challenges questions are not very clear and/or miss some elements, i don't remember wich ones exactly :/ for example "wrap the require between output buffering functions" without telling that the second one have to be assigned as a variable value to pass the challenge.
Maybe it sound logical but i have to admit that I didn't really understand what i've done after the 3rd chapter. :s
i'll now take the build a theme project wich maybe i should have take first and then go for some advanced php tracks.
After that i think i'll have to re run this track to understand the last part.
Maybe someone have some tracks or projects to recommend before running it again like some missing parts of the wordpress track.
Thanks
KJ Prince
5,145 PointsI can't seem to get past the 3rd challenge, here's my code:
<?php
function my_plugin_menu() {
add_options_page (
'My Plugin Settings Page',
'My Plugin',
'manage_options',
'my-plugin',
'my_plugin_options_page'
);
// Page Title: My Plugin Settings Page
// Menu Title: My Plugin
// Slug: Same as menu name, but with hyphens instead of spaces
// Make sure user has ability to manage plugin options
// my_plugin_options_page() is the function for what displays on the options page
}
add_action ('admin_menu', 'my_plugin_menu');
my_plugin_options_page() {
echo "Welcome to my plugin settings page.";
}
?>
I'm echoing out the welcome message, can't figure out whats wrong.
KJ Prince
5,145 PointsOoops forgot to add function my_plugin_options_page() {
CJ Williams
34,372 PointsI did the same thing.
LisaMarie Barnes
9,346 PointsThis is the correct way: add_action ('admin_menu', 'my_plugin_menu'); function my_plugin_options_page() { echo 'Welcome to my plugin settings page.';
Zoe Peng
10,809 PointsThanks Lisa, I pass the 3rd challenge with:
function my_plugin_options_page() {
echo "Welcome to my plugin settings page.";
}
Because we have to call the function, not call add_options_page
.
Marcello Vicidomini
2,488 PointsHi all, I'm having some trouble with the widget. In the widget areas, when I drop the widget into a sidebar, the following message is displayed between the title field and the num_badges field:
Total Badges Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/web-experiments/wp-content/plugins/wptreehouse-badges/inc/widget-fields.php on line 8
0
(that last 0 should be the number of total badges).
This is the line of code the message refers to:
<?php echo count ( $wptreehouse_profile->{'badges'} ); ?>
How can I solve this error? I know it appears beacuse I have the debug mode set on true, but the widget is working fine anyway, so I could simply turn the debug mode off, but I got to the same error in the front now that I'm working on the shortcode (only coming from frontend.php, line 2, where the same code is repeated), along with several other errors (i'll post them in a separate comment), so I'd like to solve this problem and make my shortcode work :D
Thanks a lot for your help!
Marcello Vicidomini
2,488 PointsUp… I'm sorry to ask again but this is really a stopper for me :(
Kelvin Atawura
Front End Web Development Techdegree Student 19,022 Pointsl am having the same bug hope Zac Gordon can share some light on this please
Marcello Vicidomini
2,488 PointsI hope so, but it's been three months since I wrote my comment here and I received no answer. I don't want the solution but I'd like to be pointed in the right direction. Honestly I'm quite disappointed.
Kelvin Atawura
Front End Web Development Techdegree Student 19,022 Pointshi Marcello Vicidomini l have been able to resolve the issue. load the Deprecated Calls plugin. this would tell you exactly where the deprecated code is. Another easy way out is to download how to build a wordpress theme files. the treehouse badges plugin can be located in its themes plugin bit. you can copy and past it in the current wordpress plugins folder you are working with. you do the usual thus set it up in your settings then put in the widget where you want it to appear on the appearance widget section. that should work.
l would say don't be disappointed with treehouse. they are amazing at what they do. let me know if you are having anymore trouble with it.
Brian McNitt
10,314 PointsI found this course pretty challenging in that it breezed through and assumed knowledge of a number of advanced WP and PHP topics (e.g. hooks, filters, widgets, shortcodes, WP JSON, AJAX, jQuery, SVN, and more) while providing little background on each. There was a lot of magic and "just copy this code" in the course where more explanation or at least links to sub tutorials would have helped. Really, the How to Build a WordPress Plugin course could/should be an entire track consisting of multiple courses. That said, it was a great "into the fire" course and aided and encouraged me to write my first plugin.
I use both Treehouse and Code School and wanted a way to eventually display badges for each on my personal site. (On that note, I know Treehouse and Code School may be seen as competitors to some degree, but I find there isn't a lot of crossover between the two. I enjoy Treehouse for friendly, approachable introduction to topics, and use Code School for deeper dives into specific technologies.) Searching the WP Plugin Directory, I was surprised that Code School didn't have a WordPress plugin -- so I used what I learned in this course to build one, add it to GitHub, and launch it in the WP Plugin Directory. It's available at:
https://wordpress.org/plugins/code-school-badges/ and
https://github.com/mcnitt/code-school-badges-wordpress-plugin
If interested in trying it out, some test Code School usernames you can try are: perry, dave, nick, mcnitt, luke,gus.
On the surface, the plugins are similar and do the same thing, display badges, but I found in working on it that there were a lot of differences. The current Code School API is not nearly as advanced or consistent as the current Treehouse API, and the way they structure their badges is different, and I chose to implement a slightly different feature set, so there was a lot of learning in doing so, so it is by no means a direct port of the Treehouse course code. (Probably the biggest lesson I learned was not to hardcode the plugin folder name in the enqueue scripts and styles section as the plugin folder name the WP Plugin Directory creates for your plugin is not necessarily the same as the folder name you use to develop and upload the plugin. This led my scripts and style links to break in the initial version. Check out the enqueue scripts pattern I used on Github that proved to be less brittle.)
But above all -- thank you, Zac for teaching this course, really great. And please don't hit me for creating the Code School plugin. ;)
valeriuv
20,999 PointsHey Zac! I enjoy your courses on Wordpress a lot, so thanks for the great content. In future courses I hope to see a bit more detailed explaining of what you're doing and why. For example, in the plugin development course, when we add a widget, you quickly go over the four functions of the Wptreehouse_Badges_Widget class, but it still is unclear what each of them does, so I just follow what you're doing but don't really understand the logic.
Zac Gordon
Treehouse Guest TeacherHey Preston Davis,
Were you trying to download all the completed files at the beginning of the project? The project downloads change throughout the project and only correspond to what is covered in each video or stage.
Does that clarify things?