Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Can't get a custom admin notice working, here's my code... not sure what's wrong.

function set_ll() {
    global $post;
    add_action('admin_notices', 'my_admin_notice');
    if ($post->post_type == 'listings') {
        global $post;
        $p['address'] = get_post_meta($post->ID, 'street_address', true);
        $p['city'] = get_post_meta($post->ID, 'city', true);
        $p['province'] = get_post_meta($post->ID, 'province', true);
        $p['postal_code'] = get_post_meta($post->ID, 'postal_code', true);
        $p['query'] = $p['address'] . ' ' . $p['city'] . ', ' . $p['province'];
        $p['result'] = getLatLng($p['query']);

        if ($p['result']) {
            //echo 'true';
            add_action('admin_notices', 'my_admin_notice');
        } else {
            add_action('admin_notices', 'my_admin_notice');
        }


        $p['long'] = $p['result']['lng'];
        $p['lat'] = $p['result']['lat'];

        //delete_post_meta($post->ID,'lat');
        //delete_post_meta($post->ID,'long');
        //update_post_meta($post->ID, 'lat', $p['long']);
        //update_post_meta($post->ID, 'long', $p['lat']);
    }
}

function my_admin_notice() {
    echo '<div class="error">
       <p>Aenean eros ante, porta commodo lacinia.</p>
    </div>';
}


add_action('save_post', 'set_ll');
?>
share|improve this question

closed as too localized by toscho Nov 14 '12 at 23:46

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.