I’ve long wanted to create a database of themes that support my SEO plugin and never came up with a manageable way of doing that. When my buddy Amir from WPML emailed me about their two new plugins, Types and Views, it took me a while to grasp what they did. Turns out I’m daft and it’s actually quite easy when you install it and they’re perfect for that job. So I thought I’d let you all enjoy what I’d done with it. I’ll review both of them, in a 3 post series in which I’ll also create my desired database.
Database of Themes that support my WordPress SEO plugin
I’ve also got a project I’ll use this for: I want a database of themes that support my WordPress SEO plugin, with some specific settings info, a screenshot, etc. I want to store these as a custom post type. So the first step is to determine which info I would need to store:
- Basic stuff:
- Title of the theme
- Short description
- Is this a paid theme or not?
- Price (if applicable)
- And some more advanced stuff:
- Does this theme have its own SEO options that “yield” to WordPress SEO?
- Does this theme support breadcrumbs?
- Does this theme require force rewrite titles to be on or not?
Creating a Custom Post Type
Having determined what I wanted to store, the next step was to create a Custom Post Type. That’s as easy as using this interface:
I could add Taxonomies to it as well, but I’ll leave that for now, although creating a taxonomy is just as easy through the Types interface. I end up with my WordPress SEO theme CPT:
Adding Custom Fields
You’ll think “huh, that hasn’t got any of the specific data yet”: that’s right. It doesn’t. That’s where the true power of Types comes in, you can create “Custom Field Groups” and add these to post types. So I did:
As you can see you can choose from a lot of different types of fields, and all these types have their own content checks. For instance for a URL, it’ll allow you to “force” a correct URL. I’ve added the custom field group to my WPSEO Themes post type, and now, when I go into edit or create a new WPSEO Theme “post”, I get this interface below the title and content area:
So, what we needed to do:
Creating a custom post type + custom fields.
- Creating a form through which people can submit themes that fills this post type.
- Creating a browsable interface for this post type.
Subscribe below to make sure you won’t miss the next two steps!
Types WordPress plugin – Easy Custom Post Types is a post by Joost de Valk on Yoast – Tweaking Websites.A good WordPress blog needs good hosting, you don’t want your blog to be slow, or, even worse, down, do you? Check out my thoughts on WordPress hosting!