Articles

Adding a custom field to your Wordpress Theme12 Mar

Once you have mastered using the basic functions within the IMPORTCSV plugin, you can really take the plugin and your wordpress site to the next level by using your own custom fields.

Now you can read all about using custom fields here at the Wordpress Codex:

http://codex.wordpress.org/Using_Custom_Fields

It took me a while to get the format right but ended up with the code below. Now this means if I add the custom field to the post section it will get published on the website wherever I decide to put this code.

Here is the code that we use to call the custom field and display it on your theme.

<?php echo get_post_meta($post->ID,’[CUSTOM FIELD NAME]‘,true);?>

[CUSTOM FIELD NAME] is replaced with your custom field name! Remove the Square brackets too.  So as an example, if I had a custom field called “Trevor”, the code would be:

<?php echo get_post_meta($post->ID,’trevor’,true);?>

Try the code out on a few posts first, and then once you are happy, add the field data to your CSV file.

Remember throughout that Wordpress is case sensitive so make sure the case is correct on the code above, in your admin panel, and in the header row of the CSV file.

Also of interest...

2 Comments For This Post

  1. Brian

    How do I use this with HeadSpace2?

    Thx!

  2. admin

    Hi Brian,

    You use it in the same way as integrating it with any other plugin. You need to find the field names for the various custom fields headpsace2 uses and add then to the CSV file you want to import.

    Make sure the titles are case sensitive

    You have to have the pro version though.

    Hope this helps….

    Jason

Leave a Reply

Requirements

The plugin needs wordpress run on your own hosting to work. While the process of uploading the plugin and csv file is simple, there is some technical knowledge needed by using excel or a spreadsheet solution to create your CSV File. Once you have built your first one and tested it, it then becomes like second nature.

Free Version

Why not signup and receive our basic ImportCSV Plugin. The free version allows you to add content as and when you require but doesn’t have the advanced features of the custom fields, nor do you get the excel spreadsheets to help build your CSV files quickly. But it will let you test the script out and it maybe that is all you need.
Your Name:
Your E-Mail: