The next step for me was to translate the project requirements into a list of development problems that I needed to solve.
Custom Post Type (CPT) for Resources
The main unit of WordPress content is a post. WordPress began as a blogging platform so the post item contains fields for information you would need in constructing a blog post. WordPress also has pages which are more like static web pages, can be arranged hierarchically and are often used to establish site structure on sites that are more than simple blogs.
What I needed here is what is called a custom post type. There are a number of advantages for using custom post types including creation of custom fields to suit your content needs and custom taxonomy (categories and tags) systems. Rather than seek a plugin which provided a ready-made custom post type for the Resources on the site, I resolved to shimmy a centimetre or two “closer to the metal” and use a plugin to create my very own custom post type, fields and taxonomies.
I opted to use the Toolset Types plugin. It is highly thought of and used quite extensively in the WordPress realm.
Multiple Thematic Paginated Loops
Sounds scary doesn’t it? If you imagine that it is a sugary breakfast cereal for content management system geeks it knocks the intimidation level down a little. At the time of course, I had no idea that what I wanted was multiple paginated loops. Nor would I ever have believed how beautiful they would be once I found them.
So what are they? Hang on tight while I break it down.
The Loop
We know that the “stuff” that we enter into WordPress is stored in a database. The loop is like a fish net that we dip into the murky database to pull some stuff out. Much like a fish net it gets some things but not others and we can tell it to get only the stuff we want.
It is called the loop because if there is more than one thing captured in the net then it loops around to process the requested information (fields) for each one. “Each one” in the context of the WordPress loop usually refers to a page, post, comment or, less commonly, some other chunk of WordPress stuff.
I know my “fishnet” metaphor was a little thin and tenuous in spots but I wanted to spare you the feelings I had when I encountered the friendly and helpful introductory material about the loop out on the web. Here’s an example from the WordPress Codex:
or another from <_techriff:
Notice the word “query” in the diagram above, a database query is what the loop really is for you database folks.
Multiple Loops
So, if the loop grabs a specified set of pages or posts, in order to have the following:
- Introductory page information
- A set of discussion posts
- A set of resources
then I will need to have three loops in my key WordPress pages, once loop grabbing each of those three sets of stuff.
Multiple Thematic Loops
Further more, the items in 1, 2, 3 in the previous section need to all relate to the same discussion area (e.g. Faculty Development, SOTL).
Multiple Thematic Paginated Loops
You may have noticed that some web pages these days will scroll down and down, seemingly infinitely, as new items are added when you get near the bottom of the page. (Facebook or Twitter for example). This is know as “infinite scrolling”.
Others will give you the first subset of your items and then provide links or page numbers to get to the next subset. (Google or Amazon for instance.) This is known in the web world as “pagination” because it splits a large amount of stuff into “pages”.
Since we have three loops, using infinite scrolling might be confusing or off-putting for some users, so we chose to display a small number of articles or resources in their sections with pagination to move to further remaining items. Here’s a look at a partial page with pagination controls (note: this is from the final site, we have some pitfalls still on the way there):
Howdy
Last on our list of development problems is changing “Howdy” to “Welcome” in the upper right corning of the admin bar.
Again looking ahead to completion, this wasn’t too difficult and was accomplished using a tried and true programming technique (we’ll see this again):
After examining zakirstage’s comment in this support thread I carefully copied and pasted the following into my theme’s function.php file (shown happily ensconced in its new habitat):
You probably noticed that what I copied and pasted was code. When I was done I had the same icky feeling as carrying a spider out of the house on the other end of a magazine.
And there was also some code further up in the loop section. My fear of code was beginning to suffer the slings and arrows of outrageous…okay, let’s just say it was getting bruised up a bit.
Anyway, let’s press on.