Jump to content


PHP & Wordpress Code for Domain URL

  • Please log in to reply
No replies to this topic

#1 Dhira

  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 10 April 2006 - 11:24 AM

Hi all,

Wordpress is full of php code to refer to the blogs location.

I need the code to refer to the url of the domain, even if wordpress is installed on a subdomain.

For example if I want to place a link for hte home page, I would use this
<a href="" target="_blank">Home Page</a>
for a site map I'd use:
<a href="/sitemap.html" target="_blank">Sitemap</a>

That works fine if the worpress blog is installed in the root of a domain or in a subfolder.
It does not work accurately if the blog is in a subdomain.
If I use the above, the urls show up as:
<a href="" target="_blank">Home Page</a>

which gives me
"http://www.subdomain.domain.com" instead of "http://www.domain.com"
<a href="/sitemap.html" target="_blank">Sitemap</a>
gives me
instead of
"http://www.domain.com/sitemap.html" which I would like.

I've tried
<a href='$ require($_SERVER["DOCUMENT_ROOT"]);/sitemap.html">Sitemap</a><br>
and variations of it to no avail. Help appreciated.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users