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.
How do I use this with HeadSpace2?
Thx!
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