Add custom fields to a custom post type
-
I have a Custom Post Type ‘services’ on my wordpress site with a number of custom fields that I can access via
require_once('../wp-blog-header.php'); query_posts(array( 'post_type' => 'service', 'showposts' => 10000 ) ); print "<table>"; print "<tr style=\"font-weight:bold;\"><td>Name</td><td>Link to entry on map</td><td>Overview</td><td>Address 1</td><td>Address 2</td><td>Address 3</td><td>Address 4</td><td>Address 5</td><td>Town/city</td><td>Postcode</td><td>Telephone</td><td>Email address</td><td>Website</td><td>Contact name</td><td>Facebook</td><td>Twitter</td><td>Youtube</td><td>Management</td><td>Referral</td><td>Local authority</td><td>Type of Service</td></tr>\n"; while (have_posts()) : the_post(); $overview = get_post_meta( get_the_ID(), 'overview_meta_box_text', true ); $address = get_post_meta( get_the_ID(), 'address_meta_box_text', true ); $address2 = get_post_meta( get_the_ID(), 'address2_meta_box_text', true ); $address3 = get_post_meta( get_the_ID(), 'address3_meta_box_text', true ); $address4 = get_post_meta( get_the_ID(), 'address4_meta_box_text', true ); $address5 = get_post_meta( get_the_ID(), 'address5_meta_box_text', true ); $city = get_post_meta( get_the_ID(), 'city_meta_box_text', true ); $postcode = get_post_meta( get_the_ID(), 'postcode_meta_box_text', true ); $telephone = get_post_meta( get_the_ID(), 'telephone_meta_box_text', true ); $email = get_post_meta( get_the_ID(), 'email_meta_box_text', true ); $web = get_post_meta( get_the_ID(), 'web_meta_box_text', true ); $web = str_replace("http://","",$web); $contact = get_post_meta( get_the_ID(), 'contact_meta_box_text', true ); $facebook = get_post_meta( get_the_ID(), 'facebook_meta_box_text', true ); $twitter = get_post_meta( get_the_ID(), 'twitter_meta_box_text', true ); $youtube = get_post_meta( get_the_ID(), 'youtube_meta_box_text', true ); $management = get_post_meta( get_the_ID(), 'management_meta_box_text', true ); $referral = get_post_meta( get_the_ID(), 'referral_meta_box_text', true );How can I add another field which would be a integer?
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Add custom fields to a custom post type’ is closed to new replies.