Home Loading an image in custom WordPress plugin
Reply: 0

Loading an image in custom WordPress plugin

user1083
1#
user1083 Published in April 26, 2018, 1:47 pm

I created my custom plugin and want to add custom logo, but somehow it keeps redirecting me to wrong dir, this is error I get:

GET http://localhost/logo.png 404 (Not Found)

Here is what I tried so far:

$plugin_dir = str_replace( $base_url, ABSPATH, $plugins_url );
$plugin_dir = plugins_url();
$plugin_dir = plugin_dir_path( __FILE__ );
$plugin_dir = WP_CONTENT_DIR . '/plugins';
$plugin_dir = plugins_url( '/', __FILE__ );

Here is my add action:

    function kalbos_modifymenu() {

        add_menu_page('Kalbos', //page title
            'Kalbos', //menu title
            'manage_options', //capabilities
            'kalbos_list', //menu slug
            'kalbos_list', //function
            $plugin_dir . 'logo.png',
            '5'
            );
}
    add_action('admin_menu','kalbos_modifymenu');

However icon is working when i move my logo to wp-admin/logo.png dir because thats where my logo path goes even if i set it go to my plugin folder

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.801045 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO