Articles of custom field

Add custom field to the archive page?

Add fields to archive? I’m using Advanced Custom Fields plugin (but it’s not relevant as I can also use native WP fields) and want to add custom field to the custom post archive page. The problem is there is no archive page by default, where you can attach the field (though you can add it […]

Add custom column for custom field

I created a custom field bookcode using the code below. So, how I can add a column for this meta data into my post type manager and make it sortable? function save_bookcode( $post_id ) { if ( wp_is_post_revision( $post_id ) ) return; // save custom field ‘bookcode’ as CFX+ID add_post_meta( $post_id, ‘bookcode’, ‘CFX’ . $post_id, […]

How to format custom fields when editing an attachment?

I’m adding some custom fields to attachments, doing roughly this in a plugin (based on this tutorial): function myplugin_add_attachment_fields( $form_fields, $post ) { $fields = array( ‘myplugin_credit’ => array( ‘label’ => ‘Credit’, ‘input’ => ‘text’, ‘application’ => ‘image’, ‘exclusions’ => array(‘audio’, ‘video’), ‘helps’ => “e.g. ‘Bob Ferris'” ) // More fields here. ); foreach($fields as […]

Can't save custom field on registration page

I have a WordPress Multisite build and I’m trying to add a custom field to the admin user registration form but the metadata isn’t saving in the initial form: after I create the user, I can go to the new profile page and the custom field will save. Here is my function to add the […] intergration with WordPress?

Wanted to know if there was any documentation or plugins that allowed a site to pull prices and other information from on DVD’s and other products. I’m creating a plugin that stores information about DVD releases and I would like to create code that pulls the price from Amazon, and calculates the difference compared […]

Post excerpt in custom meta box… help with proper php format

I have a custom meta box attached to a post type that displays ways for customers to submit new ideas. Customers are supposed to summarize their idea in 30 characters or less, which seems like a good use for post_excerpt. I’m not great with php (still learning) so any help with getting the echo statement […]

Adding Properties to User Profile and Displaying in List

I have a site that I am migrating to WordPress, and I have a need to add properties that each of the users can edit (e.g., Address, City, State, Business Name, etc), along with some properties that Administrators can edit (IsActive, CanEmail) that wouldn’t be displayed to the user. In addition, I need to be […]

wp custom field date format compare

How do I possible to work with this code to work with date format Y-n-j Value start_date = 2011-1-20 end_date = 2011-1-30 Here are the original function came from this Query between two meta values? function date_check_join( $join ) { global $wpdb; $join .= ” JOIN “.$wpdb->postmeta.” AS startdate ON (“.$wpdb->posts.”.ID = startdate.post_id AND startdate.meta_key […]

Insert Address fields into function

The code below gets the coordinates of an address/location using Google’s Geocoding API, It works manually typing an address where I have written “ADDRESS GOES HERE” below, doing so then outputs the coordinates appropriately. <?php function getCoordinates($address) { $address = urlencode($address); // set HTTP header $headers = array(‘Content-Type: application/json’); // Open connection $curl = curl_init(); […]

Comparing timestamps in meta query doesn't work

I want to compare two timestamps in a meta_query instead of comparing two dates in the “Y-m-d” format, each of them stored separately in custom fields, but no success. The first timestamp is an event start date/time, the second is the local date/time, also as a timestamp. When I use them in my code, posts […]