Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

128
Visualizações
How to display different content on the same page using different URLS

I'm using wordpress. I have query string functionally that displays the content in the correct language.

Example urls

example.com/terms/?lang=en
example.com/terms/?lang=es
example.com/terms/?lang=fr
example.com/terms/?lang=db

The code below grabs the query string value[lang code] and the API uses it to show the correct language.

<script type="text/javascript" charset="UTF-8">   
  var langCodeSearch = new URLSearchParams(window.location.search);
  var langCode = Object.fromEntries(langCodeSearch.entries());

              
   Api.Initialized.then(function() {
    Api.LoadContent(["https://url-to-api-that-has-content.json"], langCode.lang //**language declaration need to happen here**);
              });
</script>

The above code works great but would it be possible to have the same functionally but using the following URL structure?

example.com/terms/en
example.com/terms/es
example.com/terms/fr
example.com/terms/gb

I want to display content based on the last part of the URLs.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda