Dhira Posted April 10, 2006 Share Posted April 10, 2006 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[code]<a href="" target="_blank">Home Page</a>[/code]for a site map I'd use:[code]<a href="/sitemap.html" target="_blank">Sitemap</a>[/code]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:[code]<a href="" target="_blank">Home Page</a>[/code] which gives me "[b]http://www.subdomain.domain.com[/b]" instead of "[b]http://www.domain.com[/b]"and[code]<a href="/sitemap.html" target="_blank">Sitemap</a>[/code]gives me "[b]http://www.subdomain.domain.com/sitemap.html[/b]", instead of "[b]http://www.domain.com/sitemap.html[/b]" which I would like.I've tried [code]<a href='$ require($_SERVER["DOCUMENT_ROOT"]);/sitemap.html">Sitemap</a><br>[/code]and variations of it to no avail. Help appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/7013-php-wordpress-code-for-domain-url/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.