Extend Wordpress Part 1 - Custom Fields

One of the challenges with running Wordpress as a CMS (per my previous post) is being able to extend the core features to accomplish the goals for your site. These next series of articles will examine how to get more out of Wordpress than you had ever thought possible. For example purposes, we are going to create a Real Estate site powered by Wordpress 2.1.3. Lets get started…

  1. Write » Posts » and then enter a title… “Two Bedroom Ranch with a View”
  2. You might also want to add a new category called “Listings” if you haven’t already.
  3. In the post box, add a description about your property, upload some photos etc.
  4. Enter a new key… “Price” and a value… ” $150,000″ » click Add Custom Field
  5. Repeat Step 4 for each value. For example, you might want to add Agent, Status, Beds, Baths etc. Then publish your post when you’re done.

Tip: Every time you add custom field (key), it will appear in the dropdown box the next time you add a post/listing. You don’t need to type it in again!

Wordpress

 

Now all we need to do is get the information to display on your site. I have made available a modified version of the default theme in wordpress. Simply download this theme, extract the files, upload it to your wordpress themes directory and activate it. It’s called ‘Wordpress Default 2′.

Keep checking back as future articles will discuss how to make these custom fields more visually appealing both in your admin and on your live site.

Move on to Part 2 - Admin.

11 Responses to “Extend Wordpress Part 1 - Custom Fields”


  1. 1 Joe

    Looks like an excellent start! Good job!

  2. 2 Nathan Allan

    A suggestion would be to extend on this and break out the code so it is easier to update your own template.

  3. 3 Matt

    How do you mean exactly?

  4. 4 Nathan Allan

    Well I want to incorporate this in to my template rather than yours. So if I knew the code to slot in I would do that. Perhaps it should work without but I am not having much luck.

  5. 5 Matt

    What trouble are you having? Have you gone through all three parts of this tutorial? I’ll be more than happy to answer some specific questions.

  6. 6 Nathan Allan

    Ok so I have Part one to work with your template “default 2″. What I am trying to do is fine the code in that template that displays the custom fields so I can slot it in to my template.

    Thanks for the help I really do appreciate it.

  7. 7 Nathan Allan

    I finally worked it out!

    I think all you ned to tell people is to make sure they have:

    in their post area.

    I will now move on to step 2!

  8. 8 Joe

    Is it possible to set up a custom field that, instead of accepting text data, contained an image instead. If this was possible, it would be very easy to place an image exactly where you wanted within a page. This would be excellent if you were trying to go for a standard directory look.

    Cheers

    Joe

  9. 9 Matt

    Why can’t text data be the name of a file? And then just stick that in an image tag? For example, create a custom field called ‘Image’… and then the person enters in: photo.jpg and you pull in that ‘text’ into the theme.

  10. 10 Seagyn Davis

    Hi,

    This is a brilliant tutorial/plugin. I am also trying to adapt it to my template. What code must we place in our template page to get it to work on our templates.

    Thanks

  11. 11 Matt

    Read Part 2 and 3 :) If you still have questions, let me know.

  1. 1 Extend Wordpress Part 2 - Admin at Zurnet
  2. 2 Extend Wordpress Part 3 - Templates at Zurnet

Leave a Reply