get_post_custom_keys($post->ID);
-
Hello,
If there’re keys (or a single key is) added from the custom-fields my dynamic sidebar should hide. It should only appear when there’s no custom-fields used in posts. But there’s something wrong with my if/else block, I think.
First I couldn’t found a template tag which allowes me to proof if there’s a custom-field-key is set. get_post_custom_keys($post->ID) returns an array, so far. Converted to string I thought I can handle it:
<?php $keys = implode("", array_splice(get_post_custom_keys($post->ID), 0, -2)); if ($keys == '') : if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(2) ) : endif; endif; ?>
It is functioning as long as the keys from custom-fields is more then three. But if I have only one custom field added to my posts – this won’t work…
Do anyone know a code-snippet or a template tag for getting this runnin’? I cannot figured it out…
thx, maiskolben
- The topic ‘get_post_custom_keys($post->ID);’ is closed to new replies.