Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Dynamic links

  • I’d like to put a link on an about us page which will be linked to a meet the team page, then replicated across many sites. So I’d like the link to be something like {site_url}/meet-the-team to avoid having to go in and manually change the link every time. The page will always be called meet-the-team but the site url will of course change. I’m cloning a base site then fleshing out those kinds of details. I thought perhaps I could simplify it if it could be dynamic.

    Appreciate the help in advance.

  • Hi there,

    You don’t need to site URL in the link, simply set the link to /meet-the-team should link to the right page no matter what the site link is.

  • I see a few ideas but I suspect there is an easier way πŸ™‚

    1. Use this plugin after the fact but then again that creates steps.
    2. There is a suggestion here
    https://wordpress.stackexchange.com/questions/179559/relative-or-dynamic-site-url-possible
    usually just avoid the issue entirely every time I create a new wordpress site:

    define(‘WP_HOME’, ‘/’);
    define(‘WP_SITEURL’, ‘/’);
    will cause wordpress to use root-relative urls for everything. Makes site migrations to other domains far easier.

    Is there an easier way to do it? Not that #2 is hard but is there just a native way to say <site_url>/pagename.html?

  • Thank you, I didn’t think that would work without something like this:

    define(‘WP_HOME’, ‘/’);
    define(‘WP_SITEURL’, ‘/’);
    will cause wordpress to use root-relative urls for everything. Makes site migrations to other domains far easier.

  • will cause wordpress to use root-relative urls for everything

    I’m confused. The URL will become your-site-domain/meet-the-team, isn’t this what you want?

  • Yes, that’s what I want πŸ™‚ My question was…I thought I would need to add that to the config file for what you suggested to work. But it seems to work fine without it. You are saying I can just make any link be /page-name like meet-the-team without using the site url in the link? That sure is easy! I thought I’d need to add something to make that work.

  • Yes, you only need to use the page slug as the link on any site, it will add the site’s domain in front of the page slug automatically.

  • Thanks, Ying πŸ™‚

  • No Problem πŸ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.