Firstly, don’t apologise for being a newbie! It’s great when new people start doing things for wordpress!
Does your function look like this?
function jm_insert_gensurgeon_fields() {
function some_other_function () { ... }
function another_function () { ... }
function etc() { ... }
}
Because I’m not sure that will work…
Try defining them before you define jm_insert... and then call them within that function, so something like this:
function some_other_function () { ... }
function another_function () { ... }
function etc() { ... }
function jm_insert_gensurgeon_fields() {
some_other_function();
another_function();
etc();
}
Obviously that’s simplified, but it helps illustrate what I mean.
Thread Starter
jakemc
(@jakemc)
Hi Maerk.
Thanks for the prompt reply and for being so encouraging. I love wordpress but getting into the guts of it like this is a little intimidating.
My functions are structured like this:
function jm_get_title($postID) {...}
function jm_has_specific_meta($postid,$meta_key) {...}
function jm_list_specific_meta($meta_data,$meta_key) {...}
function jm_insert_fields() {
...
if($meta_data = jm_has_specific_meta($post_ID,'professional_speciality'))
jm_list_specific_meta($meta_data,'professional_speciality');
...
}
jm_insert_fields is executed – I can see the HTML it generates – but no list of meta data that should be generated by jm_list_specific_meta is visible.
HTH and thanks again.
Hmm… instead of
function jm_has_specific_meta($postid,$meta_key) {...}
try
function jm_has_specific_meta() {
global $postid, $meta_key;
...
}
Got a feeling that won’t work either, though. It sounds like there might be a problem with one of your functions.
What does jm_list_specific_meta() contain?
Thread Starter
jakemc
(@jakemc)
Ah! The act of sharing my problem helped me to see the solution.
The problem was that I didn’t have access to variables defined in the page from the plugin so I have to get them explicitly.
In particular:
$post_ID = $_REQUEST['post'];
Oh, does it work now? I love it when things get solved, it’s like the sun coming out!
Thread Starter
jakemc
(@jakemc)
Yes it does. Thanks for you help!
Of course, I’ve now got a trickier problem but I’ll save that for a new post… 🙂