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 trialJuliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsHow to create Wordpress Widgets
Hi,
In following along with the tutorial I was able to get the Official Treehouse Badges widget to show up in my admin, however when I drag the widget over into my sidebar and refresh/visit the site I get this message that appears under the title My Treehouse Badges:
Notice: Trying to get property of non-object in /..../....../..../..../wp-content/plugins/wptreehouse-badges/inc/front-end.php on line 7
Why is this appearing and how can I fix it?
Thanks in advance to anyone who can assist:-)
1 Answer
james white
78,399 PointsFor Wordpress widgets start here:
https://codex.wordpress.org/WordPress_Widgets
Then go here:
https://codex.wordpress.org/Widgets_API
Might try googling for a few Wordpress widget tutorials as well, like these:
http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-wordpress-widget/
http://justintadlock.com/archives/2009/05/26/the-complete-guide-to-creating-widgets-in-wordpress-28
https://premium.wpmudev.org/blog/how-to-build-wordpress-widgets-like-a-pro/
https://premium.wpmudev.org/blog/featured-content-widget/
http://code.tutsplus.com/articles/building-custom-wordpress-widgets--wp-25241
http://www.makeuseof.com/tag/how-to-create-wordpress-widgets/
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsJuliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsThanks for your effort and input James, but unfortunately I don't see anything at any of these links that address the issue that I'm having.
Here is my code for front-end.php, then wp-treehouse-badges.php, and then options-page.php:
Update: I kept following along with the course and eventually caved into copy/pasting all of the code from another (future) video and now everything appears to be working, which is great, but I'm not certain that I understand why:-)