I want to have some relative links and theme images display in widgets. The sidebars show up at different levels of the URL, so an ordinary relative link won’t always work. What’s the right way to do this? No relative links? I’m working on a development/sandbox site that has a different site root structure from the production site.
Normally on a template one uses the WP hooks site_url() and get_stylesheet_directory_uri() for things like this, but I can’t put those in text widgets.
I have experimented with Shortcode Exec PHP plugin, but it seems a bit of overkill, and doesn’t work quite right when packing two shortcodes into one widget; the second shortcode doesn’t get evaluated until executed in a link, so the second link when hovered displays the shortcode.
Do I need to write custom widgets for this? I’m looking at http://codex.wordpress.org/Widgets_API and suggested resources linked there.
What I would like is for the customer to be able to edit a widget that has well formed links to the same site, and can access images that are in the theme.
which just now makes me think that for the theme images, I should just put the image I wamt to use in the media gallery, and use its link.
But this doesn’t address the problem with on site links, apart from hard-coding the full URLs into the widgets. That may be the simplest thing, but it’s not ideal.
How should I be handling this?