Get Post Meta from ID in functions.php

get_post_meta( $appointment_id, ‘_appointment_guest_name’, TRUE ); please make sure that $appointment_id will be the post id and meta_key name should be proper with that id you can check this in wp_postmeta table(check meta_key name is _appointment_guest_name or appointment_guest_name)

Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]

One way to add JavsScript in functions.phhp is to put the JavaScript into a JS file an enqueue it. With wp_enqueue_script(). js/mynicecode.js var x = myFunction(60000, 5.15464, 100); function myFunction(a, b, c) { return Math.round (a * b / c); in functions.php function my_load_scripts($hook) { wp_enqueue_script( ‘mynicecode_js’, plugins_url( ‘js/mynicecode.js’, __FILE__ ), array()); } add_action(‘wp_enqueue_scripts’, ‘my_load_scripts’);

MetaBox body is not showing (the callback function)

That global_box_meta_box_callback() is a class method (i.e. a function inside a class) and not a globally defined function, so you need to use [ $this, ‘global_box_meta_box_callback’ ] (or array( $this, ‘global_box_meta_box_callback’ )) when supplying the class method to add_meta_box(): class Foo { … function wpd_add_meta_box() { $screens = get_post_types(); foreach ( $screens as $screen ) … Read more