Portal Home > Knowledgebase > Articles Database > Home page url in php?


Home page url in php?




Posted by bambinou, 10-12-2012, 10:54 AM
Hi, I am having a problem, I have wordpress installed, I would like to add some buttons in a folder situated in: http://mysite.com/wp-content/themes/theme-name/picture The problem is that I have a lot of files and may have to change the site urls in the future. Now hardcoding the urls with the site name will not be a good idea for me, what is the php function in wordpress I could use to tell the script to always add the actual site name instead of writting "mysite.com"? I hope I am explaining this correctly... Thank you all, Ben

Posted by TwineDev, 10-12-2012, 10:59 AM
Using the following: should give you http://mysite.com/wp-content/themes/theme-name in your example. -Greg

Posted by inAsset, 10-12-2012, 11:20 AM
php bloginfo('template_url'); ?> works.

Posted by bambinou, 10-12-2012, 03:52 PM
Hi to both of you. Thank you so much for your reply. I will give it a try in a few minutes to see if it works. I really appreciate your time :-) Thank you, Ben

Posted by bambinou, 10-12-2012, 04:01 PM
Sorry, I have one more question please. You php code worked perfectly, how to get the same but now with only the domain name? http://mysite.com could be replace with which php expression please? Thank you, Ben

Posted by TwineDev, 10-12-2012, 04:14 PM
Here is a full reference to what all you can get from the bloginfo() function: http://codex.wordpress.org/Function_Reference/bloginfo You may be able to use one of those, or the home_url() function http://codex.wordpress.org/Function_Reference/home_url



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Email Abuse (Views: 783)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.