Share Tweet Reccomend

How to WordPress - Install WordPress on WAMP Server

Welcome to another episode of “How to WordPress”.. an ever-continuing collection of WordPress how to tutorials, resources, and videos.

In this session of “How to WordPress” we’ll discuss how to install WordPress on WAMP Server. Recall that in a previous episode we looked at how to install WAMP Server. Now that we have that in place we can install WordPress on WAMP Server and start running our installation just as we would be doing if this were a production environment. There are a lot of benefits to having a local WordPress setup. We can do all of our editing of pages and posts offline before publishing them. We can do our theme development locally. And we can install different plugins to test them out to see if we like them and we don’t have to worry about mucking up our production environment.

Those using Macs will want to look into MAMP server, which is essentially the same idea behind WAMP server (only for Mac).

Video below…

Share Tweet Reccomend

Using OAuth 2.0 for Google APIs

OAuth has become an incredibly popular way to manage authentication and authorization for apps — mobile, desktop, and web. What is OAuth? Well according to the OAuth site OAuth is…

An open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.

Well, to be honest that’s pretty general and might not exactly clear everything up if you’re new to OAuth. Don’t worry though. In what follows, we are going to show some really simple implementations in a couple of different languages that will hopefully help you get a better grasp on what OAuth is and whether or not it’s a good choice for you to use on your website or in your application.

Read More »

Share Tweet Reccomend

Backbone.js Collections

Collections have a bunch of different usages in Backbone.js, but at their core they are basically arrays of models. If you are unfamiliar with Backbone models it might be a good idea to check out post on Backbone.js Models It’s a fairly quick introduction so it shouldn’t take too long to consume.

Collections, being groups of models, are good for displaying lists of data. So if you wanted, for example, to display a list of musical artists, the model would be an “Artist,” containing the artist name, birthday, hometown, favoriteColor or any other information that we’d want to use in our application, and the collection (array of models) would be “Artists.” To create a collection as an ordered set of models you have to specify which type of model your collection holds by setting the model property.

var Artists = Backbone.Collection.extend({
    model: Artist
});

Again for demonstration, we’re going to actually need some models to use our collection. So let’s create one with some defaults (which we’ll be overriding anyway).

var Artist = Backbone.Model.extend({
    defaults: {
        name: 'New Artist',
        birthday: 'January 1, 1970',
        hometown: 'Los Angeles, CA',
        favoriteColor: 'blue',
    }
});

Now to instantiate a few models….

var biggie = new Artist({ id: 1, name: 'Notorious BIG', birthday: 'May 21, 1972', hometown: 'Brooklyn, NY', favoriteColor: 'green' });
var mike = new Artist({ id: 2, name: 'Mike Jones', birthday: 'January 6, 1981', hometown: 'Houston, TX', favoriteColor: 'blue' });
var taylor = new Artist({ id: 3, name: 'Taylor Swift', birthday: 'December 13, 1989', hometown: 'Reading, PA', favoriteColor: 'red' });

Note: When developing Backbone applications (or any other application for that matter) you’ll want to give your models an id property. It makes things much easier when working with lists and they’re required for doing any sort of retrieving and/or saving models from the database using the fetch and the save or sync methods.

Read More »

Share Tweet Reccomend

Backbone.js Models

Models in Backbone.js are the “data houses” for Backbone applications. They hold the data that gets fetched from the server and they get passed to the Backbone Views so that the views can display them. When users create or update data (by filling out a form and clicking a button or by some other means), that data will be housed within a model and then sent up to the server for processing.

To define a Backbone model, you have to simply have to extend the Backbone Model.

var Artist = Backbone.Model.extend({});

And then to use it we could create a new insatance…

var artist = new Artist();

Read More »

Share Tweet Reccomend

Create a Theme Config File in WordPress

One of the aspects of WordPress that people really like is the ability to add options. This is something that WordPress theme and plugin creators use heavily. They’ll create an options page or pages so that anyone who uses their theme or plugin can customize numerous different components of the theme… everything from look and feel, to contact form data, to portfolios, to just about anything else under the sun. Creating an option is as easy as storing adding an option:

<?php add_option('nbs_background_color', '#FFCC66'); ?>

Then to use an option in your webpages you just need to call get_option…

get_option('nbs_background_color')

Note: Notice that I used the prefix “nbs” (for Nine Bit Studios) before my option name. This is a common practice to prevent potential collision with other options because each option has to have a unique name. It’s very possible that another plugin that I have installed may have used the option “background_color”. By adding a prefix this is no longer an issue.

That’s all well and good, but there are a few potential downsides to this. For one, depending how your options are set up, it can be a fair amount of work to add, update, or remove options because you have to edit the code to register the option, edit the form for the user to set or update the option, edit the code to handle the values they set, etc. Hopefully, you have your theme or plugin options set up such that making changes is as smooth and easy as possible. It’s not a difficult process, but it can get a bit involved as the number of options that you want to handle grows in size and complexity.

Read More »