dimanche 6 décembre 2020

How to call image in folder PHP

Web Developer.

I want to make my own wordpress plugin, From what I look at add menu page parameters here: https://developer.wordpress.org/reference/functions/add_menu_page/

add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )

you can insert icon url inside wordpress admin menu bars.

And, I look at Sassy Social Share Plugin, the code look like this:

$page = add_menu_page( __( 'Sassy Social Share by Heateor', 'sassy-social-share' ), 'Sassy Social Share', 'manage_options', 'heateor-sss-options', array( $this, 'options_page' ), plugins_url( '../images/logo.png', __FILE__ ) );

I did the same, but not working. The image not loaded.

I want to call icon.png in my image folder here: image

This is my code:

add_action("admin_menu", "addMenu");
function addMenu(){
    add_menu_page("Example Options", "Example Options", 4, "example-options", "insideMenu", '<img src="../image/icon.png/>"');
}

function insideMenu(){
    echo"<br/>";
    echo "Hello World";

}

Any help is appreciated, Thank you.

Aucun commentaire:

Enregistrer un commentaire