106bank opera

There it is an assignment created in the new ds106 Assignment Bank template I am building out- the plan is to create the functionality of the ds106 Assignment Bank as a wordpress theme, that could be customized easily for other types of collections. It is quite far from looking and acting like the ds106 site, but I had to work out some things conceptually and under the hood before painting the living room.

To provide a flexible framework and design, I am using as a base the WP-Bootstrap theme, an implementation of Twitter Bootstrap for wordpress. Bootstrap offers both responsive features, media handling, and also a flexible grid system for the layout, and a lot of integration built in. So thi would give someone ways to build out a site with options for say, a rotating banner graphic, or a swap out new looks with addons like Bootswatch.

Wp-Bootstrap is mostly decipherable, but seems to have a particular load order of CSS which makes doing a child theme funky. Now I am all about doing child themes, it’s my standard MO for nearly every project, though I think the need for the latest version of themes overrated (this very site uses an ancient wordpress theme). And while Bootstrap 3 is imminent, what I briefly read is it might be a complete overhaul. So for this project, its going to be built now on the current version of Bootstrap which is more than solid.

But I do want to build things so custom code is separate from the core theme. My first steps today where to create the custom post types and taxonomies needed, but rather than mingling my code with the themes’s functions.php file, I am putting all my library code in a ds106 code directory in the theme, and the core functions.php brings it in as needed:

// ds106 Assignment Bank Functions, set up content types, taxonomies, etc
require_once('ds106code/106functions.php');

The other development decision was to start this site form scratch rather then importing the data from ds106 or cloning the site and trying to revamp its design. It deserves a ground up build.

The part I got done today is setting up the custom content types- this is WordPress’s powerful feature to create content that has basic features of blog posts (title, content, tags, categories) but also add extra fields or ttypes of information needed to fully describe it.

Each “assignment” in ds106 is a type- I still use “assignment” under the hood and as a slug — but it could be for your case “Lessons” “Challenges” “Tasks”. I call them “Things to Do” for the assignments and “Examples Done” for the responses people do for the, (this is an homage to the original creation of the ds106 assignment bank where Martha Burtis coded them as “Stuff to Do” and “Stuff That is Done”). This both have associated taxonomies of classifications similar to WordPress category and tags, but they are specific to certain needs- such as a Taxonomy for Types of Assignments (like a category) that define the kinds of groupings you might have, like on ds106 “Design” “Visual” “Animated GIF” etc.

On the ds106 site, we used a plugin that made it easier to set up custom post types and taxonomies- Custom Post Type UI. I’m looking to do with as few plugins as possible, and it is not that much heavy lifting to code this in– and as I found out, there is a lot more I can manage.

I used as a starting point Stephanie Leary’s Beginning WordPress 3– I saw her speak a few years ago at a Wordcamp in Phoenix, and actually got a copy of her book then. Its got a lot of useful code explanations and examples. But I also got a lift from the WordPress codex for functions like the one that creates post types.

It was there I found a useful tidbit- a hierarchal post type (more like pages than posts) can cause overhead:

Note: this parameter was planned for Pages. Be careful, when choosing it for your custom post type – if you are planning to have many entries (say – over 100), you will run into memory issue. With this parameter set to true WordPress will fetch all entries of that particular post type, together with all meta data, on each administration page load for your post type.

which I can save in this newer version. O’m not laying down a lot of code in this post, and when I get a bit more hung on the tree, I will pop the working stuff into github for sure, but the code to create the assignments type is not so hairy:

	register_post_type(
		'assignments', 
		array(
				'labels' => array(
							'name' => __( 'Things to Do'),
							'singular_name' => __('Thing to Do'),
							'add_new' => 'Add New',
							'add_new_item' => 'Add New Thing to Do',
							'edit_item' => 'Edit Thing to Do',
							'new_item' => 'New Thing to Do',
							'all_items' => 'All Things to Do',
							'view_item' => 'View Thing to Do',
							'search_items' => 'Search Things to Do',
							'not_found' =>  'No things to do found',
							'not_found_in_trash' => 'No things to do found in Trash', 
						),
						'description' => __('Tasks, assignments, lessons in the bank'),
						'public' => true,
						'show_ui' => true,
						'menu_position' => 5,
						'supports'  => array(
									'title',
									'editor',
									'custom-fields',
									'revisions',
									'thumbnail',
									'comments',
									'trackbacks',
						),
						'has_archive' => true,
						'rewrite' => true,
						'taxonomies' => array(
							'assignmenttypes',
							'assignmenttags',
							'tutorialtags',
							//'category',
							//'post-tag',
						),
							
		)
	);

I define the language used on how it appears in the admin interface. The menu_position lets me move it up higher in the left side of the dashboard menu. The things listed in ‘supports’ defines the features from a typical blog post that I want in th assignments, so here I am going to enable the comments feature (which we do not have). For now I am, commenting out attaching regular category and tags to this type. I thought it might be useful for some sites to have other means to organize assignments, and it would be easy to toggle it on (or make it a theme option later).

What i have now are the basic containers for the content, and I tossed in some dummy content I can start using to style the site:

ds106 bank

Next steps will be setting up the templates to display as we need them, add in the plugins for ratings. A bigger task is to come up with the code to have a submission form to add assignments that does not rely on Gravity Forms as a plugin (this will be a feature that can be turned off if you don’t want an open submission site)- I’ll start with this tutorial from WP-Tuts

Then it will be some work to add some interface elements to make customizing the theme via the dashboard – I will be leaning then on Incorporating the Settings API in WordPress Themes.

You can poke around as I go at http://bank.ds106.us its going to change a lot this week to look and act more like the ds106 site. And further development notes here as http://cogdogblog.com/tag/building106

FYI, the inspiration for the dummy assignment above is, of course, from twitter banter:

The post "New Content Types: ds106 Assignment Bank Nuevo" was originally thawed from a previous ice age and melted at CogDogBlog (http://cogdogblog.com/2013/08/content-types-ds106-assignment-bank-nuevo/) on August 12, 2013.

3 Comments

Leave a Comment

All fields are required. Your email address will not be published.