• I would like to embed an image in my plugin (widget). The image resides in the plugin folder (wp-content/plugins/myplugin/image.gif). How can I reference the image from within my plugin without hardcoding the path?

    Is there something like get_plugin_directory()?

    Thank you,
    Dennis

Viewing 2 replies - 1 through 2 (of 2 total)
  • Typical ways to accomplish this:

    ABSPATH . 'wp-content/plugins/myplugin/image.gif'

    ABSPATH is a WP constant that provides the full directory path to the (WordPress) installation directory.

    For providing the url, you could use:

    get_settings('siteurl') . '/wp-content/plugins/myplugin/image.gif'

    iamfletch

    (@iamfletch)

    i did this ??
    define('PLUGINPATH', ABSPATH.'wp-content/plugins/myplugin');

    and this,

    define('PLUGINLINK', get_settings('siteurl') . 'wp-content/plugins/wpajax/');

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin Path’ is closed to new replies.