Here is a summary of tweaking made for the prototype of the theme to make a ds106 assignment bank for your own uses. I managed to do this Friday afternoon while waiting for my truck to be serviced; I have to return tomorrow, so maybe the Ford dealership in Star Valley, Arizona is good for coding. They do have a dog there named “Lucky”.

On the index page for all assignment types, i added counts for the number of assignments within each type, for now just in brackets nest to the name:

(click image to see full size)

(click image to see full size)

I’m starting to get a better handle inside of the way wordpress taxonomies work (fancy geek name for the data that includes tags and categories).

Here, assignmentypes is a custom taxonomy to include the names of all the kinds of assignments (“Music”, “Gardening”, “Cooking”) – here we need to run a query to get them as data objects that we loop through to build the index. Eventually, it will be a theme option for how to order them, perhaps alphabetically, perhaps by order added, perhaps even by the number of assignments within each.

Speaking fo that, I was able to get a way to count the number of custom post types within each taxonomy term, so we can put a count next to each:

Each assignmenttype is an object from which we can use for output, so $atype->slug helps us build the url, $atype->name the title, $atype->description the info added as a description (like a category). The function get_objects_in_term provides a way to get the number of things that use that term as an array, so we can echo the number with a count() call.

In the interest of the different ways the site might be used, and to allow easy editing of the introduction text, I changed up how I was templating this one. Before I made it the front of the site using it in a front-page.php template.

Instead now, it is a simple page template (page-front.php). If used as the entry to the site, you would create a new page, and select this as a template. Then in the WordPress Reading settings, you would use the option to set the home of the site to a static page (this one).

(click image for full size)

(click image for full size)

What this means is you could have an index of all the assignments as an ordinary wordpress page, not necessarily the front of the site; the index could be a normal blog flow (say for a course site that would have the assignment bank as an interior feature).

This also means the introduction and even title is something you would enter as normal page content. I also thought it will be useful for this screen, and maybe widgets elsewhere, to start making some shortcodes so you could each the number of assignments, number of examples in the bank. These are easy to do in the functions.php file:

Yes, the layouts are not too stylized now and are ripe with placeholders for things like icons:

(click image for full size)

(click image for full size)

I am thinking of leaving it pretty un-styled, but set up classes so it would be easy to add your own CSS. Or maybe set up something in the Theme Customization API for styling things like the divs for each assignment, or maybe a system for having preset sub theme styles or …

I would like to have a customization option for the size of the icons. I have a one size added as one created for each upload for both the index page and the individual assignment page; as a them option, you could then define the shapes/sizes of the icons (and also the width of social media embeds).

Now, I have to dive into some means to have the assignment submission form working…

This is one in a series of posts documenting the creating of a WordPress theme that can give you a version of the ds106 Assignment Bank for your own purposes.

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as


Leave a Reply

Your email address will not be published. Required fields are marked *