SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    802
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    linking images to pages in wp

    Hello all:

    I have an image on my main page. I wold like for the user to click on it and be taken to a diff page.

    Normally in a static website it'd be as in below:

    Code:
    <a href="engineering.php"><img src="<?php bloginfo('template_directory'); ?>/imgs/hmEngMedImg01.png" alt="engineering"/></a>
    how do I achieve the same type of direct link in wp plase?
    was thinking of
    Code:
     <a href="<?php bloginfo('template_directory'); ?>'engineering'"> image here</a>
    & in this case the engineering page is one that was created in the wp admin panel. so it is not an engineering.php (although it'd be good to know how to link to those as well.
    thx

  2. #2
    SitePoint Evangelist snecz's Avatar
    Join Date
    Mar 2007
    Location
    Warsaw, Poland
    Posts
    429
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe this code:

    <a href="<?php echo site_url(); ?>/engineering"><img src="<?php echo site_url(); ?>/wp-content/themes/your-theme-name/images/image-name.png" alt=""/></a>
    Warsaw - the city that survived its own death.
    EMM8 - Profesjonalne Strony Internetowe
    Projektowanie Stron WWW

  3. #3
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    802
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thank you Snecz will go try it out.

  4. #4
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    802
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hello Snecz. Finally got a chance to try it and it looks like it works on my sandbox. Tweaked it slighlty diff on the <img src>bit but it works! Lot's of other stuff to fix but at least that one works :-)
    thank you.

    Code:
    <a href="<?php echo site_url(); ?>/engineering"><img src="<?php bloginfo('template_directory'); ?>/imgs/hmEngMedImg.png" alt="staffing"/></a>


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •