Title: Add nd remove admin bubble notification
Last modified: February 27, 2018

---

# Add nd remove admin bubble notification

 *  Resolved [ozobo](https://wordpress.org/support/users/ozobo/)
 * (@ozobo)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/add-nd-remove-admin-bubble-notification/)
 * Hello everyone,
 * i’m developping my custom plugin and i want to add bubble notification.
 * When my field called “Option 1” is empty i want to add a bubble on my menu.
 * When it’s not empty i want hide the bubble.
 * I thinked about use an add_action(admin_menu) hook and then create a function
   where :
 *     ```
       add_menu_page("My plugin" , printf(__('Plugin %s'), "<span class='update-plugins count-$count' title='Myplugin><span class='update-count'>" . number_format_i18n($count) . "</span></span>"),'manage_options')
       ```
   
 * With ĉount receiving if my parameter is empty or not
 * But it doesn’t working when the field is not empty.

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/add-nd-remove-admin-bubble-notification/#post-10022075)
 * You should conditionally set the menu title to one string with the notification
   or another without. I’m not sure how you would determine your plugin field value,
   but making up a function as an example, something like
 *     ```
       $option = get_my_plugin_field('option-1');
       if ( $option ) {
         $title = 'Just the Title';
       } else {
         $title = 'Title with notification';
       }
       add_menu_page('My Plugin", $title, 'manage_options', 'my-plugin-menu');
       ```
   
 * You can boil that down into a one liner with ternary operators, but it’s much
   more difficult to read and I’d advise against it. (ternary operators are used
   in the construct `if_true()?'do this':'else this';`)

Viewing 1 replies (of 1 total)

The topic ‘Add nd remove admin bubble notification’ is closed to new replies.

## Tags

 * [custom plugin](https://wordpress.org/support/topic-tag/custom-plugin/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/add-nd-remove-admin-bubble-notification/#post-10022075)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
