Conditional in meta box render
-
I’m trying to pass from this function:
function prezzo_minimo_meta_box_render( $post ){ // Get the number and display it in a numeric field $number = get_post_meta( $post->ID, "function_prezzo_primo", true ); echo '<div><input type="number" name="function_prezzo_primo" value="'. round( $number/7, 0 ) .'" placeholder="prezzo/notte in euro" /></div>'; }to this other one:
function prezzo_minimo_meta_box_render( $post ){ $number = get_post_meta( $post->ID, "function_prezzo_primo",true ); $number2 = get_post_meta( $post->ID, "function_prezzo_primo_dom" ,true); // Get the number and display it in a numeric field if( !empty( get_post_meta( $post->ID, "function_prezzo_primo", true ))) { $output= '<div><input type="number". $number . 'round( $number/7, 0 ) .'" placeholder="prezzo/notte in euro" /></div>'; echo "$output"; } elseif (!empty(get_post_meta( $post->ID, "function_prezzo_primo_dom"))) { $output= '<div><input type="number". $number2 . 'round( $number2/7, 0 ) .'" placeholder="prezzo/notte in euro" /></div>'; echo "output"; } else {$output= '' }else {$output= '' } }I have problems with the syntax, at least about the round price
The page I need help with: [log in to see the link]
The topic ‘Conditional in meta box render’ is closed to new replies.