New field on checkout is shown but it’s not saved on the order details [closed]

As far as I remember you need to manually save your custom fields values via woocommerce_checkout_update_order_meta hook. Try add_action( ‘woocommerce_checkout_update_order_meta’, ‘custom_checkout_fields_update_order_meta’ ); function custom_checkout_fields_update_order_meta( $order_id ) { update_post_meta( $order_id, ‘billing_colonia’, sanitize_text_field( $_POST[‘billing_colonia’] ) ); update_post_meta( $order_id, ‘shipping_colonia’, sanitize_text_field( $_POST[‘shipping_colonia’] ) ); }

Is it possible to update the total price on the checkout page in woocommerce from a custom field

Well, you can use a WooCommerce hook( woocommerce_before_calculate_totals ) I will give an example so that it may be easier to understand what you believe. As far as you know , I think you problem will be fixed function calculate_embossing_fee( $cart_object ) { if( !WC()->session->__isset( “reload_checkout” )) { /* Gift wrap price */ $additionalPrice = … Read more

Shortcode To Display Post Custom Field Value in Post Title, Post Content

the_title filter takes two parameters, one of them is the ID of the post for which it was called. Something like that should work. add_filter( ‘the_title’, ‘se385007_title_filter’, 20, 2 ); function se385007_title_filter( $title, $post_id ) { $new_title = str_replace( “[geo_name]”, “[geo_name post_id=$post_id]”, $title ); return do_shortcode( $new_title ); )

wp_query to print posts if have X custom field value

You could use meta_query, it can handle arrays and strings. So something like this // get location meta, will be easier to determine what is the type of value $location = get_post_meta(get_the_ID(), ‘Location’,true); $posts = get_posts([ ‘posts_per_page’ => 10, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘meta_query’ => [ [ ‘key’ => ‘Location’, … Read more

Syntax Issue: How Do I Call A Custom Field Inside a ForEach Statement? [closed]

<ul> <?php $recent_posts = wp_get_recent_posts(array(‘post_type’=>’news’)); foreach( $recent_posts as $recent ) { echo ‘<li><a href=”‘ . get_permalink($recent[“ID”]) . ‘” title=”Look ‘.esc_attr($recent[“post_title”]).'” >’ . $recent[“post_title”].'</a> </li> ‘; echo ‘<p>’ . get_field(“news_source”,$recent[“ID”]) . ‘</p>’; } ?> </ul> It looks your are passing get field parameters incorrectly. I assumed “news_source” is your custom field name in acf.

Hide custom column in admin template screen (Elementor) [closed]

Use the second parameter $post_type passed to manage_posts_columns and ignore adding the column if it matches elementor_library: add_filter( ‘manage_posts_columns’, ‘customfield_add_column’, 5, 2 /* <= Make sure you add the 2 here to pass the second parameter to your callback */ ); function customfield_add_column( $defaults, $post_type = null ) { if ( $post_type !== ‘elementor_library’ ) … Read more

Displaying page image in the footer automatically

You want to use the Featured Post Thumbnail: http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/ http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/ http://codex.wordpress.org/Function_Reference/the_post_thumbnail In your functions.php, define an image size with add_image_size(), then display it in the footer like this: the_post_thumbnail(‘footer-image’); Keep all of the loop inside of your main template file and do not split it across multiple files. That’s really messy, and as you’ve figured … Read more