Title: Difficulty including image directory for widget plugin
Last modified: August 20, 2016

---

# Difficulty including image directory for widget plugin

 *  Resolved [Sarah_Frantz](https://wordpress.org/support/users/sarah_frantz/)
 * (@sarah_frantz)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/difficulty-including-image-directory-for-widget-plugin/)
 * Forgive me if I’ve posted this question to the wrong forum.
 * I want to use a graphic with my widget, but I’m having difficulty including the
   directory that contains the images specific to the plugin. If someone could point
   me in the right direction that would be great! The path I want to get to to make
   the images in the plugin’s stylesheet work is:
 * my_plugin > assets > images
 * So far if I absolutely link to the path of the images they work, but this doesn’t
   help me when I want to package this widget for other installations of WordPress.
 * Thank you in advance!

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

 *  [Tom McFarlin](https://wordpress.org/support/users/tommcfarlin/)
 * (@tommcfarlin)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/difficulty-including-image-directory-for-widget-plugin/#post-3389826)
 * This will depend on if you’re looking at retrieve it by its file level path or
   its URL.
 * I typically use the following:
 * `plugins_url( 'widget-name/assets/images/admin.png' )`
 * Try that – if it doesn’t work, let me know!
 *  Thread Starter [Sarah_Frantz](https://wordpress.org/support/users/sarah_frantz/)
 * (@sarah_frantz)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/difficulty-including-image-directory-for-widget-plugin/#post-3389832)
 * Hey Tom!
 * I’m thinking more so by its file level path. Let me explain a little bit more
   in-depth the widget I’ve created and perhaps that might help make sense of which
   route to take..
 * The widget is VERY simple. It is just a textarea where the user can enter in 
   information. The box that is built in the sidebar houses a div with a background
   image. I’m referencing a stylesheet within the widget plugin to retrieve the 
   styles for this div – however the background images only work if I use the exact
   path to their location (i.e. the full website url) … I basically want to make
   this all “relative” so that I can recycle this plugin on other sites I have, 
   so using the absolute path to the image wont work.
 * I’m sure this is more of a file path/structure issue or even a css thing more
   than anything..
 * Have I confused you?
 *  Thread Starter [Sarah_Frantz](https://wordpress.org/support/users/sarah_frantz/)
 * (@sarah_frantz)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/difficulty-including-image-directory-for-widget-plugin/#post-3389841)
 * OH I’m dumb. haha you’re right. Sorry. Thank you!
 * Guess I need more coffee…
 *  [Tom McFarlin](https://wordpress.org/support/users/tommcfarlin/)
 * (@tommcfarlin)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/difficulty-including-image-directory-for-widget-plugin/#post-3389901)
 * Don’t we all? 😉

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

The topic ‘Difficulty including image directory for widget plugin’ is closed to 
new replies.

## Tags

 * [plugin-development](https://wordpress.org/support/topic-tag/plugin-development/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Tom McFarlin](https://wordpress.org/support/users/tommcfarlin/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/difficulty-including-image-directory-for-widget-plugin/#post-3389901)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
