Custom Fields
Re-Envisioned
Support MB Settings Page add Logo as admin toolbar item

  • Creator
    Topic
  • #31898
    Sash
    Participant

    Hi, there

    So far, I've loaded the logo into the Admin Toolbar as shown in the code below with a normal img tag. Now I would like, when the customer uploads the logo for the website on the settings page, that the Logo also displayed in the admin toolbar too.

    I've tried a rwmb_get_value and rwmb_meta shortcode, but it doesn't seem to work that way.
    How could I do that? Is there a possible way to do this?

    $admin_bar->add_menu( array(
        'id'    => 'logo',
        'class'    => 'admin-toolbar-logo',
        'title' => '<img style="margin-top:-4px; margin-left:-2px; margin-right:10px; padding:0px; height:42px;" src="Image url" alt="">', 
        'href'  => 'Home url', 
        'meta'  => array(
            'target' => '_self',
            'onclick'  => 'doThisJS()',
        ),
    ));

    cheers,
    Sash

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #31899
    Sash
    Participant

    Like this
    Link to Image

    #31903
    Long Nguyen
    Moderator

    Hi Sash,

    In the admin area, to use the helper functions rwmb_get_value or rwmb_meta, you need to hook your function to action init with the priority later than 20 or use the WordPress function get_option() to get the field value of the settings page.

    #31906
    Sash
    Participant

    Hi, Long

    Thx for your answer. Would you be so nice and give me an conde example of how I do it with the init hook or the get_option version ...

    I'm still a little inexperienced with it... this would help me a lot.

    Thx a lot.

    Cheers,
    Sash

    #31913
    Long Nguyen
    Moderator

    Hi,

    Please follow this documentation to know how to use the function get_option()
    https://docs.metabox.io/extensions/mb-settings-page/#getting-field-value

    #31915
    Sash
    Participant

    Hi, Long

    Thx for your answer. Would you be so nice and give me an code example of how I do it with the init hook or the get_option version ...

    I'm still a little inexperienced with it... this would help me a lot.

    Thx a lot.

    Cheers,
    Sash

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.