CUSTOM POST TYPE VS REPEATER IN PAGE
TEMPLATE
QUESTIONS TO ASK YOURSELF
- Are the items going to be listed in more than one page on the
site?
- Are there any categories/taxonomies required for the items?
- Is it something that clearly stands out as it’s own type of
object rather than a part of a page (eg products, news items)?
- Is it very important to the site overall (ie would the cms
user be likely to be using it quite a bit and want to be able to
get to it and edit it quickly)?
- Will there need to be a reference to the items (ACF
relationship field) in other sections of the CMS?
If you answered yes to any of the above, then consider setting up
a custom post type, otherwise, use a repeater in the page
template.
SETTING UP THE LIST PAGE FOR A CUSTOM
POST TYPE
The standard way for displaying the list of items from a custom
post type is to use the {post-slug}-archive.php template. The
downside of using this technique is:
- You can’t have any additional custom fields for the page,
unless you create a new tab in the “Site settings” section,
which isn’t a great user experience for an administrator.
- You can’t change the page url
The preferred method is to turn off the archive for the custom
post type, and then create a custom page template that lists all
the post type items. This means that you can also create a custom
field group that is associated with the page, which makes it more
intuitive for the admin as they just search for the page and edit
the custom fields.
OPTIONS PAGE
There are going to be some global elements that need to be
content managed, and some elements that just don’t fit anywhere
else. This is where the ACF options page comes in handy (see http://www.advancedcustomfields.com/add-ons/options-page/
A common name to call this in the CMS is “Site settings”. Note
that we’ll be hiding the wordpress settings from the end-user so
this shouldn’t cause confusion (only admin will be able to see
settings).
A few notes on usage:
- Ideally separate the options page into tabs. Each tab
represents a different logical area of the site (eg header,
footer, contact form)
- Don’t go crazy with it. Only setup elements that you expect
the admin to use.
KEEPING SECURITY AND SEO IN MIND
One of the major detractors for wordpress is it’s security. We’ve
likely all had wordpress sites hacked in the past, but it’s not
difficult to do the basics of securing them.
- Redirect all non-https traffic to https if you have ssl
- Complete as many of the iThemes Security recommendations as
possible
- If it’s possible, lock the /wp-admin folder to only the ip
addresses that are required (yours and the clients)
SEO will often be in the client’s hands. If you’ve installed
Yeost, make sure to flag to the client that they’ll need to
populate the fields.
WHEN TO SETUP CUSTOM DB TABLES
The default table structure of wordpress is very flexible, but
not very well optimised for large data sets. All the custom fields
are stored in the wp_meta table as key value pairs. This means
that it can be a hassle to manage content directly if needed and
also slow for complex queries.
If you have very large data sets or you need quick queries,
consider creating a custom plugin that will create the db table(s)
and setup the admin interface (https://codex.wordpress.org/Creating_Tables_with_Plugins)
CLEANUP
Before sending the build to the client to review, make sure you:
- Create a new wordpress user for the client
- Use adminize to hide any menu items that the client doesn’t
need to see
- Remove all testing users and testing content
- Hide any fields in custom post types or templates that aren’t
needed
- Hide Yeost SEO fields from anything that doesn’t display
as a page on the site. You can do this from SEO > titles &
meta
FINAL NOTES / CHECKLIST
Before sending the build to the client to review, make sure you:
- Does your staging/development version of the site have search
engine visibility discouraged, and the live version has this
option turned off?
- Do you have a 404 page setup?
- Has google analytics been implemented?
- Do you have ssl? If so, are you redirecting all non-https
traffic to https (including www)?
- Have you got a favicon?
- Always try to look at the CMS like you were the user. They
should only see what they need to see.
- Please don’t EVER expect the user to know html to be able to
manage the content
- No matter what the user does in the cms, they shouldn’t be
able to make the site look broken
- Make sure that all wordpress user passwords are unique and
proper passwords (no admin / admin please)
- Don’t use a plugin for something that you could build yourself
reasonably quickly (too many plugins are a liability)
- Never directly delete anything. Always backup first before
deleting. This includes database, files, server setups.
- Images should be resized on the fly on the frontend using
something like https://github.com/syamilmj/Aqua-Resizer