• Resolved Gyoo

    (@gyoo)


    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • I don’t know of a plugin but I’m thinking the admin_bar_menu hook would let you do it.

    Thread Starter Gyoo

    (@gyoo)

    A bit more explanations would be appreciated please ??

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

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

    Thread Starter Gyoo

    (@gyoo)

    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.

    Thread Starter Gyoo

    (@gyoo)

    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 ?

    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);

    Thread Starter Gyoo

    (@gyoo)

    Well, I checked what is the argument to pass here and the priority is already to 1000, look at where the quote goes :
    https://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…

    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.

    Thread Starter Gyoo

    (@gyoo)

    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 ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Quotes in the admin bar’ is closed to new replies.