Question

Is there a way to do normal links in WordPress (not image source links) in a "relative" manner??

Im doing custom site in WP and some portions of the site, for example an image link that when clicked, leads to a specific dynamically built WordPress page, i always link them absolutely.

So for example, if the website wordpress page i want link to is page_id=39 and the site is XYZ.com then my image link would be etc...

Problem with this is that when i take the site from a test server to the live server i have to manually go in again and redo ALL the manual links.

Unlike the image relative links which look something like this <img src="<?php bloginfo('template_directory');?>/image here"/> where this relatively looks for physical image somewhere on the site, the WordPress pages don't exist in the traditional sense of an actual page.php etc so, how can i get around this, is there some function i can employ that will get me using relative links/path builder to actual dynamic wordpress pages so that i dont have to manually/absolutely link something?

Thanks in advanced.

Was it helpful?

Solution

as you get the link for an image with <?php bloginfo('template_directory');?>/iamges/... the same way you can get urls for any page <a href="<?php bloginfo('url');?>/?page_id=39"> another way (better way) would be to get the permalink to the page using page's id

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top