Skip to:
Content
Pages
Categories
Search
Top
Bottom

relative path for custom images

  • Avatar of pivey
    pivey
    Participant

    @pivey

    Hello,

    i need to keep my custom images on the same level as bp-default/_inc/images

    and prefer to define a relative path rather than a absolute path like:

    <?php echo get_template_directory_uri() . ‘/_inc/customfolder/my_image.gif’ ?>

    But it does not work.

    Your help is highly appreciated

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of pivey
    pivey
    Participant

    @pivey

    stupid question?

    Avatar of pivey
    pivey
    Participant

    @pivey

    i prefer to use the relative path instead of using the whole domain, as when moving to a different domain, i will not need to change all customized links.

    Might be useful for others as well.. ? Please help a newbie

    Avatar of Travel-Junkie
    Boris
    Participant

    @travel-junkie

    Well, the link you posted above in your first post will work on any domain and you won’t have to change a thing, except you might want to use get_stylesheet_directory_uri() instead of get_template_directory_uri(). The first function returns the child theme location (if there is one) while the second one returns the parent theme location.

    Avatar of pivey
    pivey
    Participant

    @pivey

    thank you travel junkie, you are right.

    It did not work as i added the “wp-content” path after the get_stylesheet_directory_uri() .

    Your recommendations are very helpful.

    I buy a Weissbier :-)

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

You must be logged in to reply to this topic.