hcaandersen
Forum Replies Created
-
Thank you so much for this! It got me where I wanted to go.
For anyone else reading this, I modified n8kowald’s if-elseif-else-shortcode, by adding ‘allow_bookings’ to the array returned by get_allowed_callables() and adding the following function:
function allow_bookings() { $post_id = get_the_ID(); $geodir_post = geodir_get_post_info($post_id); if (!empty($geodir_post)) return $geodir_post->allow_bookings ? true : false; return false; }I added a Geodirectory custom field called ‘Allow bookings’ and was then able to use the shortcode like this:
[if allow_bookings] [app_book] [else] This provider is not currently accepting online bookings. [/if][app_book] comes from WP-BASE.
Oh, sorry. That’s obviously coming from another plug-in.
In that case, perhaps you can advise me on some integration. Basically I just want to get the value of a GD custom field from another plug-in. I’ve successfully used geodir_post_custom_fields() to get a list of GD’s custom fields and then found my own custom field in the list. When I pass it to geodir_get_cf_value(), however, I get an error saying that $gd_post doesn’t have a property, ID. I’ve put in some trace and $gd_post seems to be empty. Do I need to call another function to get $gd_post initialized?