Setting up a cron job to auto update a custom field
Setting up a cron job to auto update a custom field
Setting up a cron job to auto update a custom field
Arrays in custom fields or is there a better way?
How to use the Term Object from a custom select field in a query
Instead of getting all of the image IDs and then cycling through them and outputting each one, you would first collect them into a single array and then use array_unique() to remove the duplicates. if( $categories_du_projet ) : $image_array(); foreach( $categories_du_projet as $term ) : if( $image_du_projet ) : $image_array[] = $image_du_projet; endif; endforeach; $image_array … Read more
Try: $postintro2 = get_post_meta ($post->ID, ‘postintro2’, true); if ( ! empty( $postintro2 ) ) { echo ‘<div class=”single2-intro”>’.$postintro2.'</div>’; } From the codex: get_post_meta
I solved this by storing value in post meta table
The most basic option I can think of is this add_shortcode(‘bt_featured_image_acf_location’, ‘bt_featured_image_acf_location’); function bt_featured_image_acf_location ($atts) { return get_field(‘location’, get_post_thumbnail_id()); } Change ‘location’ to your acf field name and thats it. get_post_thumbnail_id() will get the current post featured image id. Once you have the ID of the post (images are posts, they are of the post … Read more
Found the solution 🙂 add_action(‘edit_form_after_title’, function() { global $post, $wp_meta_boxes; do_meta_boxes(get_current_screen(), ‘advanced’, $post); unset($wp_meta_boxes[get_post_type($post)][‘advanced’]); }); add_action(‘add_meta_boxes’, ‘generator_api’);
You can use insert_user_meta($user_id,’meta_key’,’meta_value’); when you want to get that keys, you can get like $keys = get_user_meta($user_id,’meta_key’); in $keys variable you get an array of all keys.
Hook into the post status transitions and copy the post title to your secondary field. See documentation: https://codex.wordpress.org/Post_Status_Transitions#transition_post_status_Hook