I am making a plugin that adds meta boxes to post. i have a function that currently defines 3 meta boxes. now when i define the callback that prints the mockup there seems to be a problem
I get the error: Warning: call_user_func(oap_price_mockup) [function.call-user-func]: First argument is expected to be a valid callback in /home1/xx/public_html/xx/wp-admin/includes/template.php on line 927
Here is my code:
/* Add Costum Field*/
function add_custom_meta_boxes() {
/* Adding image meta box to post */
add_meta_box(
'oap_image_box',
'Painting Larges Image',
'oap_image_mockup',
'post',
'side'
);
/* Adding price meta box to post */
add_meta_box(
'oap_price_box',
'Product Price',
'oap_price_mockup',
'post',
'side',
'high'
);
/* Adding variation meta box to post */
add_meta_box(
'oap_variation_box',
'Product Variation',
'oap_variation_mockup',
'post',
'normal',
'high'
);
}
add_action('add_meta_boxes', 'add_custom_meta_boxes');
/* Prints the image html mockup */
function oap_image_mockup( $post ) {
wp_nonce_field( plugin_basename( __FILE__ ), 'image_price_variation' );
$productImage = get_post_meta( $post->ID, 'productFullSizeImage', true );
if($productImage){
$html = '<div class="imageHolder"><img src="'.$productImage.'"></div>';
}else{
$html = '';
}
$html .= '<p class="description">Upload full painting size image</p>
<input id="oap_paintingImageID" name="oap_paintingImage" value="" size="25" type="file">
';
echo $html; ;
}
/* Prints the price html mockup */
function oap_price_mackup( $post ) {
$productPrice = intval( get_post_meta( $post->ID, 'productPrice', true ) );
$html = '$ <input type="text" size="7" name="productPrice" placeholder="price" value="'.(($productPrice != '') ? $productPrice : '').'" />';
echo $html;
}
/* Prints the price html mockup */
function oap_variation_mockup( $post ) {
$productVariation = get_post_meta( $post->ID, 'productVariation', true );
$variation_res = oap_get_meta_table($productVariation); // ignore private fucntion that parse this string and returns a table and counter
$variationTable = $variation_res['table'];
$variationCounter = $variation_res['counter'];
$html = $variationTable;
$html .= '<input type="hidden" id="variationCount" value="'.(($variationCounter != '') ? $variationCounter : 1).'" />';
echo $html;
}
Thanks in advanced
'oap_price_mockup'->function oap_price_mackup– Milo Jan 17 at 22:42