Check if a field is capitalized?
$field = ‘First Name’; if(ucwords($field) !== $field){ // not capitalized }else{ // capitalized } see ucwords()
$field = ‘First Name’; if(ucwords($field) !== $field){ // not capitalized }else{ // capitalized } see ucwords()
As taken from : http://wordpress.org/extend/plugins/media-custom-fields/faq/ How does this plugin handle my data? Media items are stored in WordPress just like regular posts. This enables us to use native WordPress functions to store and retrieve your custom fields. Due to this, your data is stored in a very future-proof way, in the postmeta table of the … Read more
I have used custom fields in the past to do something kinda like this. You name each custom field the same, and then in the value, give it some separation character. I used ||. Then you can do something like this: $output = array(); foreach($custom as $c) $output[] = explode(‘||’,$c); Then you’ll have an array … Read more
You are using the wrong name on the radio inputs, radio-inline but when you try to get that value you are using $_POST[‘gender’] I’ve updated you code and made some improvement too, with the checked() function function show_extra_profile_fields( $user ) { $gender = get_user_meta( $user->ID, ‘gender’, true ); ?> <section> <label class=”label” for=”gender”>Gender</label> <div class=”inline-group”> … Read more
You need to use the hooks attachment fields to edit / save to ad and save the fields. function add_attachment_field_credit( $form_fields, $post ) { $form_fields[‘paper-type’] = array( ‘label’ => ‘Paper type’, ‘input’ => ‘text’, ‘value’ => get_post_meta( $post->ID, ‘paper_type’, true ), ‘helps’ => ‘Photo paper type’ ); return $form_fields; } add_filter( ‘attachment_fields_to_edit’, ‘add_attachment_field_credit’, 10, 2 … Read more
CLARIFICATION FOR ALL : You use virtual products on your shop. On checkout page, you have created and set an additional checkbox for european VAT purpose. There is 3 cases related to this checkbox. Checkbox is hidden (default) Checkbox is visible when selected country is an european country: Checkbox disabled (default) => set the VAT … Read more
I think this is what you’re looking for… function wpa_content_filter( $content ) { global $post; if( $meta = get_post_meta( $post->ID, ‘demo_link’, true ) ) { return $content.’ <a href=”‘.$meta.'”>’.$meta.'</a>’; } return $content; } add_filter( ‘the_content’, ‘wpa_content_filter’, 10 );
The position param is responsible for that. You can find all params with descriptions here. So you’ll have to change that part of your code: ‘options’ => array ( ‘position’ => ‘normal’, ‘layout’ => ‘no_box’, ‘hide_on_screen’ => array ( ), ), to this: ‘options’ => array ( ‘position’ => ‘acf_after_title’, ‘layout’ => ‘no_box’, ‘hide_on_screen’ => … Read more
All you need to do is to use save_post hook. Here’s how: function change_post_status_based_on_custom_field( $post_id ) { // If this is just a revision, don’t do anything. if ( wp_is_post_revision( $post_id ) ) return; // Get field value $value = get_post_meta( $post_id, ‘played’, true ); $status = $value ? ‘publish’ : ‘draft’; // If status … Read more
Since you are storing an url for each image you can create a query to get the id of the attachment based on the guid: global $wpdb; $ids = array(); foreach ($images as $image_url) { $ids[] = $wpdb->get_col($wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE guid=’%s’;”, $image_url)); } Another way would be to simply store the ID rather … Read more