WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Quotes in the admin bar (10 posts)

  1. Gyoo
    Member
    Posted 2 years ago #

    Hello,

    I've seen quite a bunch of plugins that put custom quotes into a sidebar in a widget, but not in the admin bar.
    Do you know any plugin that could do that ?

    Thanks by advance,
    Gyoo.

  2. s_ha_dum
    Member
    Posted 2 years ago #

    I don't know of a plugin but I'm thinking the admin_bar_menu hook would let you do it.

  3. Gyoo
    Member
    Posted 2 years ago #

    A bit more explanations would be appreciated please :)

  4. s_ha_dum
    Member
    Posted 2 years ago #

    Hooks let you alter the behavior of functions in the WordPress core without requiring any edits to the WordPress core. Basically, you want this:

    http://wpengineer.com/2113/add-menus-to-the-admin-bar-of-wordpress/

  5. Gyoo
    Member
    Posted 2 years ago #

    Thank you for the link, I'll try this when I'll be in a better mood :3
    I think I know how to proceed to get it work. I'm not a PHP/CSS pro but I think I can do something with it.

  6. Gyoo
    Member
    Posted 2 years ago #

    Hello again,

    I managed to create a little thing with this hook, thank you again for the tip.
    But now, I face a problem : I want this "menu" to show on the right side of the bar. Is it something to do in the CSS file or can I change it directly in my PHP file ?

  7. s_ha_dum
    Member
    Posted 2 years ago #

    When you register it, you can pass a numeric 'position' value that might do what you need. For example:

    add_filter('admin_bar_menu','your_function',100);

  8. Gyoo
    Member
    Posted 2 years ago #

    Well, I checked what is the argument to pass here and the priority is already to 1000, look at where the quote goes :
    http://puu.sh/J0ys
    (Quote is "Sandvich is good !")

    What I want is to get the quote written on the right side of the bar, next to the BP notifications (little "0" on the right)
    I've checked Counterize's menu, the priority is set to 999 :| But I can't find how it's done for buddypress' things...

  9. s_ha_dum
    Member
    Posted 2 years ago #

    Hah! :)

    When your create the menu with $wp_admin_bar->add_menu include 'parent'=>'top-secondary' in the array. Then when you run add_filter you want a small number like '1' instead of a large one.

  10. Gyoo
    Member
    Posted 2 years ago #

    That's perfect, thank you really much :)

    For your opinion, when I put 1 to the priority with the 'top-secondary' array, it went to be on the far right. I put 1000 again and it was perfectly where I want, just on the left of thoses BuddyPress things :)

    Thank you once again ! One day, if I manage to make a user-friendly interface, I may upload my plugin to WordPress' database who knows :)

Topic Closed

This topic has been closed to new replies.

About this Topic