WordPress, hardcoding page but want relative links to image

I paid a guy to build a website for me, http://www.brilliantzenaudio.com, but I ran out of money so I’m trying to learn how to make some modifications myself.

I’m “hardcoding” front-page.php rather than using the control panel editor. I want to link to some images and I want to use relative links if possible. If I put an image in themes/brilliantzen/assets/img/ how do I write the link to that in the tag? Or on the other hand, if I put an image in the library how do I refer to it with php code?

Related posts

Leave a Reply

1 comment

  1. This will give you the path to your root:

    <?php bloginfo( 'url' ); ?> 
    

    This will give you the path to your theme directory:

    <?php bloginfo( 'stylesheet_directory' ); ?> 
    

    This will also give you the path to theme:

    <?php get_template_directory(); ?>
    

    Here is an example of how I have done it:

     <img src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/example.png" />
    

    Here are the docs on this:

    http://codex.wordpress.org/Function_Reference/bloginfo