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 trialColin Marshall
32,861 PointsLooking for help with the WordPress Plugin Boilerplate
I'm building a WordPress plugin that can display your Discogs collection. I am building it with the WordPress Plugin Boilerplate which is object oriented.
I was able to setup an admin settings page which stores a Discogs API consumer key, consumer secret, and their username. All that works just fine, but from here is where I am a bit lost about the placement of functions. I understand that the WP Plugin Boilerplate has separate classes for code that runs in the admin only, on the front-end only, or on both.
I have functions like the ones below and I really have no idea where to place them and then how to use them.
Example functions:
<?php
function wp_discogs_get_collection() {
// function that retrieves a user's collection
}
function wp_discogs_get_release_artwork($release_id) {
// function that retrieves the URL for album art for a release
}
function wp_discogs_get_profile() {
// function that gets a users profile information
}
Pretty much all of these functions will run on both the back-end and the front-end. Do I want to create a new class for a "collection" and have these as methods on the collection? Or do I place these all in the main class that is in the /includes
folder?
Thanks!