Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8425287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:13:45+00:00 2026-06-10T04:13:45+00:00

I am working on a multi-language function on wordpress. Each article or page will

  • 0

I am working on a multi-language function on wordpress. Each article or page will contain 2 language versions, I need to use a tag to separate them and let my JavaScript knows which section to pull according to the current language option.

I may have something like this in the editor?

[english]
English Content
[/english]
[chinese]
中文内容
[/chinese]

OK so my question is how to have a function to let javascript to recognise the [] and the text in it? or is this something that can be done in the wordpress API? since I have seen kinds of plugins using this in the article.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:13:46+00:00Added an answer on June 10, 2026 at 4:13 am

    I would advise you don’t create your own tags, but use normal html element with the lang attribute:

    <div lang="en">
       English Content
    </div>
    <div lang="zh">
       中文内容
    </div>
    

    This way you can use the standard css and javascript to work with the content, like this:

    *[lang=zh]{
       display:none;
    }
    

    and then you could switch the display via javascript when the chinese language is chosen.

    The universal selector * should be avoided if possible and replaced for a more specific selector.

    Alternatively, if you don’t want to bother your client with html-stuff, let them write these pseudo-tags [english] / [chinese] and convert these after saving into the divs with the according language tags.

    Simple regex for capturing the content of such tags (not failproof!):

    /\[english\](.*?)\[\/english\]/  // -> content will be in first capturegroup
    

    Just for fun i coded some tiny example how such a replacement could work:

    Replacement of custom tags into divs with language-id

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I develop an app for working with multi-language resources. In database, when I need
I'm working on a multi-language solution in Sitecore and want to use the DisplayName
I'm working on a multi-language website. I have a problem with the color of
I'm working on a multi-lingual WPF project that will be localized into many different
I am working on a multi language file. My urls look something like this:
I'm working on a multi-lingual search engine. I need to map keywords in English
I'm working on a multi-user phonebank software. I originally was planning to use Windows
I am working on a website with multi-language support. The URLs are in the
I'm making a multi language website and i decided to use sessions to remember
I am currently working on a project which supports multi-language. I have created a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.