WordPress.org

Ready to get started?Download WordPress

Forums

How to add relative links within a site? (4 posts)

  1. brookie
    Member
    Posted 4 years ago #

    Hi,

    I am developing a site in a subdirectory. When it goes live I will move it to the root directory.

    However, I need to link from lots of places to the "contact us" page.

    How can I put links in such that when I relocate the site they are still valid?

    Thanks.

  2. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    Something along this line should work:

    <a href="<?php bloginfo('url'); ?>/contact-us/">Contact Us</a>
  3. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Will that work inside the post/page content without a run-php plugin?

  4. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    Will that work inside the post/page content without a run-php plugin?

    Not likely, and a good point to make. I would expect the code above to be used as "hard-code" in the custom template(s)/theme being created.

Topic Closed

This topic has been closed to new replies.

About this Topic