Previously
Just to recap, at this point I have:
- copied and pasted my way out of the Howdy/Welcome nightmare
- used a well-designed and straightforward plugin to create a “resource” custom post type with appropriate custom fields and taxonomies.
So, having picked and eaten all the low-hang fruit it was time to dig into solving the big problems.
Spoiler Alert
Astute and seasoned WordPresstidigitators will already be shaking their heads and snickering while they notice my oversight. Custom post types are a method of getting things into the database and I have not provided for a method of getting custom post types out of the database in my development problems.
Multiple Loops
So, as previously discussed I had SO Page Builder active on the site and thought I would noodle around with laying out a page and see if I could find someway of getting my three loops in place.
Now, SO Page Builder gives you a way to divide your space into rows and columns and then put “widgets” in the resulting areas. We haven’t talked about widgets and we don’t really have time. They are typically little blocks of stuff in the sidebars and footers, but Page Builder lets you use them to build the content of the page (including one that does the same thing as the add post interface).
Let me show you a couple of pix. First, this is the layout screen of the intro area of one of the site pages. You can see the rows, columns and widget areas. The content bits are inside the widgets. (However, Site Origins Page Builder is one of the few in the breed of page builders that will copy its content back into a normal post. I don’t have time to get into why this is important, email me or catch me later.)
Notice the “Add Widget” Button in the top left of the above image. Once you have a spot to put a widget you press that button and you get this window (widgets can be added via plugins):
Oh look, what’s that? Over there, to the right, down a bit:
I honestly thought I’d won the lottery. The page builder layout we looked at above takes care of loop 1. This widget took care of loop 2, the discussion posts which were using the normal post type. And the widget almost took care of loop 3, it got the title and a couple of other fields but did not display the custom fields from my carefully crafted custom post type.
To be clear, it is not the fault of the Post Loop widget. It did faithfully what I asked it to. I failed to ask it to do the right thing. Why? Because I didn’t know what the right thing was at the time. I didn’t realize that I had not provided a way of pulling my custom stuff out of the database.
So, naturally, I arrogantly blamed my setback on the tools I had chosen and went off in search of other tools.