• I’ve searched high and low…

    I made a custom WordPress theme for myself, hooray. I made a different version of that theme and I now have a mild issue.

    On one of my pages, I use images to represent a rating of movies I’ve seen. I refer to those images that are in a directory above the themes directory, so my graphics are then not appropriate for the updated theme.

    My question would be how to call from a directory releative to the current theme, from within a post. I’ve attempted variations of “../images/stars/3.gif” and even the “<?php bloginfo(‘stylesheet_directory’); ?>/images/stars…”. I want to be able to pull theme elements from within posts.

    Maybe I’m just going about it wrong.

    https://www.evilkirk.com (in light theme, movies page)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Stuff that displays on the page is not relative to the theme, it’s relative to the current URL. Since the current URL depends mostly on your permalink structure, linking to images must either be absolutely referenced, or relatively referenced to the root.

    If you didn’t get that, all I’m really saying is that when you stick an image in your post, you either need to include the full URL (http//yoursite.com/directory/to/the/image.png) or you need to reference it by the root directory of the entire website (img src=”/blog/wp-content/themes/yourtheme/images/image.png”).

    Thread Starter evilkirk

    (@evilkirk)

    Thanks for the reply. So there is no (easy) way inside a post to reference images to make them come from the images directory of the current theme? So that from within the post the image reference is sensitive to the active them, yielding the appropriately-style images.

    Maybe there’s something that can be done through CSS.

    Thread Starter evilkirk

    (@evilkirk)

    Ok, found a solution…

    The runPHP plugin.

    Now I can use the “<?php bloginfo(‘stylesheet_directory’); ?>/images/stars/3.gif” option.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Theme images and absolute paths’ is closed to new replies.