how to add radio field on user meta on function.php?

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

Add image custom attribute [closed]

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

woocommerce how in checkout to add my custom field check box, and when i check it hide the shipping adress and add tax 19% [closed]

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

Add Custom field under the post title [closed]

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

Change post status by custom fields

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

Post count by meta_key meta_value [closed]

// retrieve all meta_values with key ‘state’ from database $state_posts = $wpdb->get_results(” SELECT meta_value FROM “. $wpdb->prefix.”postmeta WHERE meta_key = ‘state’ ORDER BY meta_value ASC”, ARRAY_A ); // define counting array $state_count = array(); // iterate through meta_values, count the occurence of each state foreach ( $state_posts as $state_post ) { if ( isset ( … Read more

Get single image from custom fields made with WCK custom fields creator

Here is the code that worked. I had to get rid of the foreach loop and reference the array directly: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); $productimgs = get_post_meta( $post->ID, ‘productimg’, true ); $image_color = $productimgs[0][‘product-image-color’]; $image_bw = $productimgs[0][‘product-image-bw’]; $imgclr = wp_get_attachment_image_src( $image_color, ‘grid-large’ ); $imgbw = wp_get_attachment_image_src( $image_bw, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)