I work with PHP since 8 years and I never took a look on WordPress. In the start of this year a customer requires me to develop his next website, but using the WordPress. So I had to search some tutorials on the Internet and join informations to make my own way to think using WordPress.
In this first post I’ll explain how to THINK in the WordPress way, the files you need to customize, create and how to get posts in yours next website pages.
How WordPress works
The first question I had is how to imagine a new website in the WordPress way. It’s easy, because it has only 2 ways of save data: Posts and Pages.
It’s simple to understand. Let’s take a sample website content to explain better:
- About Us
What’s Page and what’s is Posts?
My way of think using WordPress is: What you have more than one item is Post and what you have just one item is Page. For example:
- About Us: Only a single page with some text information about the company PAGE
- Customers: Here we have 1, 2, 3 … N customers, so we have a lot os “Post type Customers” POST
- Services: This example company do 5 types of services, so here we have “Post type Services” POST
Custom Post Type
Since WordPress 3.0 we can create our own post types. There are a lot of plugins that help you to create custom post type. It’s simple and easy to use. Those plugins will create a new item on the admin navigation (on the left) with the post type you want. For example: for the customers post type we’ll have a new topic on the navigation called Customers and there we’ll add new posts (customers type). You can create as many Customers you want, and we’ll explain how to retrive them later.
In WordPress we can also create custom fields for pages and post types. So, if you want to add a image to your Customers you can do that. There is too some plugins that make this a bit simple, where you can choose the field name and the field type, like: text, textarea, file, image, radio, checkbox, etc…
The interesting thing is you can add custom fields to pages too. You can, for example, add a “company mission” field on the About Us page. What you must do is just add a field called company_misson in that page. Resuming, you can add what you want to pages and posts.
In the next post I’will explain how you can start creating your first WordPress theme, for this new website we’re creating…