Plugin Author
XYDAC
(@deepakseth)
Hey Nir,
As you have seen i use a different format to store data, The format is as below:
meta_name : {field_name}
meta value : array({field_type} => {field_value})
If you wanna coin a function yourself then you can, Else i’ll write it up sometimes later..:)
Regards,
-Xydac
Thread Starter
Nir
(@nirabrgmailcom)
can You show and example of using the add_post_meta/update_post_meta with your format ?
Thanks.
Plugin Author
XYDAC
(@deepakseth)
update_post_meta(post->ID,$field_name,array('text'=>$field_value));
this should work, else i would check it out later when i return. I am traveling right now.
Regards,
-Xydac
Thread Starter
Nir
(@nirabrgmailcom)
Thanks a lot,
Two more questions:
1. what if the key is not ‘text’ ? could that be ?
2. how do You get the value – please show an example of get_post_meta().
Again, thanks in advance,
Nir
Plugin Author
XYDAC
(@deepakseth)
Hey,
1. yes it’s possible that key is not text, it’s different for each field type. look for $name=” in fieldtype/class-fieldtype.php files.
2.get_post_meta()
should work as follow :
global $post;
$val = get_post_meta($post->ID, {field_name}, true);
echo $val[{fieldtype}];
for example if field type = text, fieldname = username then
global $post;
$val = get_post_meta($post->ID, 'username', true);
echo $val['text'];
Hope this solves your problem,
BTW sorry for delay in response.
Regards,
-Xydac