ThemeShaper Forums » Thematic


Insert linked image into div

(6 posts)
  • Started 12 years ago by willforsyth
  • Latest reply from willforsyth
  • This topic is not resolved
  1. Sorry for asking so many questions but trying to get my head around stuff.

    I am trying to insert an linked image into a div using a function.
    I have inserted the div's into my sidebar and want one to have an image in.

    Here is the code

    function my_sidebar() { ?>
    <div class="aboutme aside main-aside"><h2>about me</h2><p>blah blah blah</p></div>
    <div class="skills aside main-aside"><img src="image/hirebutton.png" alt="my image"></div>

    add_action('thematic_abovemainasides', 'my_sidebar');

    //////////////and the css//////////

    border-left:1px #d5d5d5 solid;
    float: right;

    the "my image" is the only part of the code that shows up in the sidebar div.

    the only way I can get the image to show up in the div is by adding a background image to it. However this is not then a linked image.

    If looking at the site so far helps its at its the "about me blah blah blah" (sorry my dummy content is bad) section in the sidebar.

    Hope this makes sense

    Posted 12 years ago #
  2. i don't see "my image" at all. are you sure that is the correct path? is the image in the images folder in the root directory? if so, then try

    <img src="/images/hireme.png" />

    if it is in your child theme folder then use

    <img src="<?php get_stylesheet_directory_uri() ?>/images/hireme.png" />

    i'm not 100% sure if you need that / right before images so try it both ways.

    Posted 12 years ago #
  3. At the moment i've removed the function line to insert the image and put the dummy content back in. I will try both methods again today.

    The image is in my images file in my child theme.

    It works when I insert it into the background of my div in css using url("images/hireme.png").

    Would I use a different path when selection it in the function file?

    thanks alot for your help over the past few weeks very very appreciated.

    Posted 12 years ago #
  4. Tried both methods and still can only get the image to show up when I insert it using css.


    Posted 12 years ago #
  5. ok- i thought i remembered running into this problem the other day, but just verified... for some reason (don't ask me what) it seems to work if you echo out the image tag. so here is some code that definitely inserts an image above the sidebar.

    function my_sidebar() { ?>
    <div class="skills aside main-aside"><h3>Dummy TExt</h3>
    <?php echo '<a href="#"><img src="' . get_bloginfo('stylesheet_directory') .'/images/wallpaper.jpg" alt="photo" height ="30" width="30" /></a>';
    <?php }
    add_action('thematic_abovemainasides', 'my_sidebar');
    Posted 12 years ago #
  6. thanks will try that method now it may be better than the work around I did to get the image to show.

    I did this.

    I placed a link in the sidebar function instead of the image tag.

    <a class:"hire"..............

    Then styling it in css and adding image background to the different states.

    This creates the rollover button technique to.

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.