Jump to content


Photo
- - - - -

Url In Php


Best Answer Simon_P , 11 December 2012 - 02:17 PM

without the $this-> 

get_stylesheet_directory_uri() is a core wp function.

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 alexcox6

alexcox6

    Member

  • Members

  • 18 posts
  • Country: Country Flag

Posted 11 December 2012 - 01:29 PM

Hi All

 

I am working on a section for our website and i am having a problem with the image url.

 

The code below gives me the location of wp-content/themes/imsm-website-child-theme/sections/pagelines-sections/images/ourimage.gif and it needs to be wp-content/themes/imsm-website-child-theme/images/ourimage.gif

 

            if (ploption('business_image'))
                    printf('<img src="%s">' , $this->base_url. "/images/" .$business_image);                
                echo'</div>';  

 

Can anyone help with a fix as it driving me crazy

 

Cheers

 

Alex



#2 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 11 December 2012 - 02:03 PM

WordPress codex 

Please Login or Register to see this Hidden Content



#3 alexcox6

alexcox6

    Member

  • Members

  • 18 posts
  • Country: Country Flag

Posted 11 December 2012 - 02:06 PM

I have already tried to replace $this->base_url. with $this->get_stylesheet_directory_uri(); it breaks the theme



#4 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 11 December 2012 - 02:17 PM   Best Answer

without the $this-> 

get_stylesheet_directory_uri() is a core wp function.


  • alexcox6 likes this

#5 alexcox6

alexcox6

    Member

  • Members

  • 18 posts
  • Country: Country Flag

Posted 11 December 2012 - 02:26 PM

Ok, I get it now makes complete sense, Thank you simon.