As a WordPress site owner, I wanted to have more flexibility and control over my content so looked towards custom post types and custom meta fields. This is the journey of how a non-developer learnt to structure post types, custom meta fields, the plugins and libraries I've used to create my sites with and some tips for making the editor more user friendly so all the extra fields don’t feel overwhelming.
21. CREATING a custom post type
http://www.stuckinthetree.co.uk/dev-blog/getting-started-with-wordpress-custom-post-types-and-fields/
https://codex.wordpress.org/Function_Reference/register_post_type
39. ORDERING METABOXES in editor
$context $priority
advanced
default
high
low
core
normal
default
high
low
core
side
default
high
low
core
Positions are relative
Only 12 positions
In case of tie is alphanumeric
65. WE LIKE fun and games
• Archive template
• Displaying custom posts
• Each with own post meta
http://www.stuckinthetree.co.uk/bake-off-bingo-generator/
This will become apparent when you see shots of my site
This will become apparent when I talk about code (especially if you’re a developer)
I’M HAPPY TO PLAY WITH CODE AND CROSS MY FINGERS IT DOESN’T BREAK TOO MUCH
We’re going to look at one of my projects. Stuck in the Tree helps bingo players research new sites to play at before they sign up.
I started Stuck in the Tree a few years ago when I was working as an SEO to test theories and tinker with things.
I now use it to test out marketing ideas and learn more about WordPress and PHP
I’ll take you from where I started to where custom fields etc has taken things
Out of the box WordPress has post and pages, you can extend it to have any number of custom post types
. Common examples would be book or movie databases, or products in an online shop. You can also create custom fields which you can see here being use for the product price, and rating. Potentially also the product description and the image. (Example Theme from https://woocommerce.com/storefront/)
Most of the sections on Stuck in the Tree including are powered by WordPress Custom Post types behind the scenes. So a pretty conventional use in our bingo site reviews but also a little unusual to power some of our fun quizzes and our bingo cards.
When you’re working on a project there are two main approaches
We went chose to launch a minimum viable product and then do continual development. Otherwise the site would never have been launched. So we’ve learnt a lot and made a lot of changes along the way
Didn’t need drag and drop for creating and managing post types taxonomies and fields
Wanted a bit of assistance with the meta boxes
Want to learn more / understand behind scenes
Whilte we use custom post types form the off, for the bingo reviews we use of custom fields to pull through key data onto archive pages, for example the value of the free bonus, site logo
But the reviews themselves were one very long block of text and html.
Load of html and layout stuff in the editor
Long time to create a new review
Risk of error high
Design / layout of reviews have to be altered one by one.
Standard WordPress method
Standard WordPress method
Rather than using WordPress standard methods it uses the CMB plugins functions which are simplified
Standard WordPress method
This plugin was a compromise as we’re not going to want to regularly update the admin menu we may look at doing this without a plugin in future but for now we’ve got other things to focus on.
But if other people are using the backend then it can be better to just hide them automatically with a few lines of code.
Explain why used ‘manage options’ rather than administrators.
Various workarounds
We use custom fields for our images so don’t and won’t use it
We removed support for it for this post type
Various workarounds
We use custom fields for our images so don’t and won’t use it
We removed support for it for this post type
Positioning is relative
Only 12 real position options
in the case of a tie it will go by the numbers and alphabetically - so consider this when naming your fields
So fine if you only have a few fields and no fields fro other plugins
Pain if you have lots of fields and other plugins too
Can be changed by users who can switch between 1 and 2 column layout and drag and drop the metaboxes around.
Setting the height of the editor
Specifying which quicktags we want
And removing the add media button
The first page you’ll see when you login
For most people this just adds an extra step and they are not interested in this page
You can expand the dashboard by making new Dashboard Widgets
Change the landing page when you login
You could show based on user roles so Admins can see one page and non-admins can be shown a different page
E.g. a content calendar, the All Posts page etc.
The skys the limit really
We like creating interactive content and use custom posts types and fields to created them.
For example bingo card generators are just an archive template displaying a custom posts each with their own post meta.