Update custom table on metabox POST
Variable scope – you need to globalise $wpdb before you can use it inside your function: function save_metaboxes() { global $wpdb; // Rest of your code }
Variable scope – you need to globalise $wpdb before you can use it inside your function: function save_metaboxes() { global $wpdb; // Rest of your code }
Depending on the ngg_images shortcode, you maybe need to echo the do_shortcode function. You can try function lilap_gid($atts, $content = “”){ $gid = get_post_meta(get_the_ID(), ‘gallery_id’, TRUE); ob_start(); echo do_shortcode( ‘[ngg_images tag_ids=”‘. $gid .'”]’); $content = ob_get_clean(); return $content; } add_shortcode( ‘gallery_display’, ‘lilap_gid’ );
I would recommend not using this in this way. I use ACF for pretty much everything outside of a basic content area. I’d recommend either using the tabs system or, probably more preferably, the Flexible Content add-on (it used to be an add-on, but is now part of ACF Pro). You can minimize/hide the flexible … Read more
it need custom code to create repeatable fields but if you want ready-made solution than you may try this : https://github.com/WebDevStudios/CMB2 just include it in your theme/plugin and than check it’s example-functions.php file , it have example of repeatable fields 🙂 here is direct documentation link : http://cmb2.io/docs/field-types#-types-group it also support many other fields . … Read more
You can use the save_post hook. add_action( ‘save_post’, ‘mytheme_my_post_just_updated’ ); function mytheme_my_post_just_updated($post_id){ $deal_type = get_field($post_id, ‘deal_type’); if($deal_type == ‘sold’){ $gallery = get_field($post_id, ‘gallery’);// This bit and the next few lines will depend on how you’ve set up the custom field. // Fast forward a few lines… foreach($images as $image){ // I’m assuming that $images is … Read more
Ok, since we’re going the post meta route (as opposed to options), there’s a much cleaner and efficient way to grab a post by it’s title: if ( $info = get_page_by_title( ‘Business Info’, OBJECT, ‘post’ ) ) { // do stuff } Don’t let the page in the function name throw you off – the … Read more
I have two issues above that are related. php the_title() is outputting the most recent blog post title on the blog list page within my banner (or creating a banner for each blog title on the list page depending on the described circumstance). My advanced custom field used to insert an img url into the … Read more
Your options should have a key => value structure if you want it to return something other than the key number: ‘options’ => array( ‘option_a’ => __(‘option a’, ‘woocommerce’ ), ‘option_b’ => __(‘option b’, ‘woocommerce’ ) ) );
Registering custom fields group might have been limited to the custom post type. Check the limit so that I should appear everywhere.
How about using a proper metabox framework for your project? I’m sure that`s not the single metabox you’ll be using. I recommend you https://metabox.io/meta-box/ – I used it on many of my projects and have features for dynamic fields as well. Happy new year!