• So, the title is potentially misleading as I’m not sure the term “dynamic link” is appropriate.

    I have a website created in wordpress with a navigation bar at the top, which is visible on every page that you visit. The links are “static”, they do not change from page to page. So, for example, you might see mysite.com/aboutus as one of the links in the navigation menu.

    I also set up a plugin (qtranslate, but that’s not too important) to change the language by essentially providing a copy of each page in Spanish. So going to mysite.com/aboutus/?lang=es changes it to Spanish. Now as you navigate it adds /?lang=es to each page you visit, so the entire site remains in Spanish as you navigate around.

    Here’s the issue, the first time you click the link (located in the navigation bar and visible on every page) it takes you back to the homepage to change the language, because the link is “static”. So clicking on Spanish takes you back to mysite.com/?lang=es. I want to make that link “dynamic” so that it changes relative to the page your viewing. So if you’re viewing the about us page at mysite.com/aboutus and you switch to Spanish it takes you to mysite.com/aboutus/?lang=es and not the home page in Spanish.

    As the link is in the navigation bar, the same link appears on every page, so I cannot manually set the link for every page (it would also be very time consuming just because of the number of pages).

    So in other words, how can I make the link go to mysite.com/[current page]/?lang=es?

    Thank you all.

    [on a somewhat related side note, I posted the same question earlier, but the phrasing was rather horrible, and I’m not sure anyone would have gathered what I was trying to ask. As I could not delete or edit, I simply marked it “resolved” and wrote a (hopefully) more understandable question.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Check out the Bilingual Linker plug-in – it may do what you want.

    On second thought, if you’re already using qtranslate, this other plug-in may be redundant. I’d encourage you to add “qtranslate” as a tag so the plug-in author may find this post more easily as this does seem like a feature that may already be built into qtranslate. Have you already tried contacting the qtranslate developer?

    Thread Starter Pena47

    (@pena47)

    Well I added the tag, and I have posted on the qtranslate forums. I’ve looked pretty thoroughly through the settings on qtranslate and feel there is no option to do what I want to do, although it does include a widget that can be added to the sidebar of each page. I’d much rather have the links in the navigation bar at the top though, I just need them to follow the format: mysite.com/[current page]/?lang=es?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How do I create a "dynamic" link?’ is closed to new replies.