Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Add image to the adminbar/toolbar/

  • Avatar of LePasi
    LePasi
    Participant

    @lepasi

    Hey hey !
    on my website on the top, you can see the tool bar:
    – when user is logged OUT / not registered => Login & Register Button on the left side.
    – when user is logged IN => other stuff bla bla

    Now i just want a new div container that i can modify over css NEXT TO THE Register Button.
    I want to put a small image into this div. Not more.
    div_container
    I tried some advices and codesnippets from forum, also tried to modify some php files on my own.
    Does anyone has a clue where and how to modify what file ?
    Thanks ! !

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    You willl find hundreds of answers to this question, because what you want to customize is the wordpress 3.3+ Toolbar.
    i.e here: http://wp.smashingmagazine.com/2012/03/01/inside-the-wordpress-toolbar/

    Avatar of LePasi
    LePasi
    Participant

    @lepasi

    Hey thanks for your reply, but
    this is absolutely not what i’m lookin for. As i mentioned before, i already go through some code and stuff , i also found this already (also in your link)
    `/**
    * Add the Smashing WP Exoplanets menu
    */
    function smashing_wp_exoplanets_menu() {
    global $wp_admin_bar;
    $wp_admin_bar->add_menu(array(
    ‘id’ => ‘smashing-wp-exoplanets’,
    ‘title’ => __(‘ExoplanetArchive’),
    ‘href’ => ‘http://exoplanetarchive.ipac.caltech.edu/index.html’
    ));
    }`

    so you can add a new menu item. Even if this doesn’t work for me, i didn’t try to add a new menu, but an image. .

    anyone ?

    Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    @lepasi,

    Sending menu is exactly the same thing as sending a picture for the above code. The only difference is the one send’s  text, and the other one could send a picture.

    But you “don”t want to create a menu“. Ghost !

    So if you already played around with code, you probably noticed that the toolbar contains a register button, and that button use some css id and class.

    So play with CSS and add your picture to the right of the register button. I wouldn’t offense you by tellling how to add a picture into a list.

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    Study the code from this plugin that @chouf1 and @hnla helped considerably:

    https://github.com/bphelp/custom_toolbar/blob/master/custom-toolbar.php

    This should help you achieve your requirement. Pay particular attention to the code on line 78 and after to see how the images are added.

    Avatar of LePasi
    LePasi
    Participant

    @lepasi

    @Chouf1 Thanks, i know for sure how to change css of an element, but i have to create this element at first …

    and the code i was looking for is :
    ` $wp_toolbar->add_node(array(
    ‘id’ => ‘bp-notifications’,
    ‘title’ => __(‘ ‘),
    ‘href’ => bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/notices/’,
    /*’meta’ => array(‘class’ => ‘notifications’)*/
    )); `
    thanks to @bp-help , this is how to add a picture.

    Am i right, with the code above, there will be a div with the id bp-notification and a image will be place into it ? Is there a way to just create a div with a certain id and then control the image via background (css) ?

    I added the code and right now my code in this section (bp-member-adminbar.php) is this:
    Pastebin Code

    THE RESULT is … the toolbar disappeard. :(

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    Opening and closing php tags might help!

    Avatar of LePasi
    LePasi
    Participant

    @lepasi

    you mean “<? php" ?

    Avatar of LePasi
    LePasi
    Participant

    @lepasi

    ah god … i just changed “$wp_toolbar” to “$wp_admin_bar” … now it does something :)

    let’s go on from here , thanks !!

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.