Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1397336

    Hello!
    I’m doing some updates to my website and have run into a problem with a code block on the Spanish (and French) versions of my home page.
    The English home page works fine: I have a code block with HTML that displays an animated word cloud (in English).
    However, when I update the Spanish version this page (I use WPML), changing the HTML code to the Spanish version of the word cloud, the opening and ending HTML tags are removed after I click Update.

    To explain further;
    – I edit the Spanish Home page.
    – I click the one Code Block element in that page, remove the HTML that was copied from the English page, and paste the HTML with the Spanish version of the world cloud.
    – I click Save.
    – Before clicking Update, if I open the Code Block again, all the code is there. Click Save.
    – I click Update. The Spanish word cloud is not displayed on my Page.
    – I open the Code Block again and notice that the opening HTML tags have been removed. These ones:
    <html>
    <head>
    <title>Content Types Word Cloud ES</title>
    <meta name=”author” content=”WordArt.com”>
    </head>
    <body>
    The ending HTML tags have also been removed:
    </body>
    </html>

    This does not happen on the English page. I click update as often as I want and the above code that get removed on the Spanish page never gets removed on the English page. It does happen on the French page too, which I’ve only just copied across. On the French page, on copying the content from the English page, the above code is removed (but it is still fine on the English page).

    I realise this may be a WPML problem, but it is happening outside WPML in the code block itself so I suspect the Enfold theme first! Although it’s weird it’s happening on copied pages.

    Any ideas why this is happening and how to fix it?
    Thanks,
    Keith

    #1397337

    By the way, if I replace the HTML on the English page with the HTML for the Spanish word cloud, the Spanish word cloud is displayed, so I know the HTML code works.

    #1397582

    Hi,
    Thanks for your patience, the HTML that you are adding to the code block is not correct, it is not good to add

    <html>
    <head>
    <title>Content Types Word Cloud EN</title>
    <meta name=”author” content=”WordArt.com”>
    </head>
    <body>

    on any page a second time, it causes conflicts.
    The second opening HTML is stripped out of the source code to correct the error, it is better to not add this error on the English page to start with.
    Please try removing this from the start of your code

    <html>
    <head>
    <title>Content Types Word Cloud EN</title>
    <meta name=”author” content=”WordArt.com”>
    </head>
    <body>

    and this from the end of your code

    </body>
    </html>

    and then re-traslate your page.
    Let us know if you need any help with this.

    Best regards,
    Mike

    #1397619

    Hi Mike,

    Thanks for your reply and sorry that you had to correct what I had entered in the code block on the English page. I used an external service to create this HTML for me and was told to just copy the code into the code block.

    I removed the code you highlighted from the English page and, as expected, it still worked on the English.
    I also added a code block with less code to display the date and time (just for testing purposes). You can see this on the English home page in the section “Your IT and business content translated, edited and proofread”: after this H2, there is the date and time (code block 1) and the English word cloud (code block 2, with your corrections).

    However, I still have the problem that the word cloud will not display on other language pages. Even before I start translating the French page (i.e. after overwriting the French page with the content from the English page using WPML’s “Overwrite with English content” button; so with the English and French pages exactly the same), the word cloud from code block 2 (same code as on the English page) is not displayed on the French page. The date and time from code block IS displayed, and continues to be displayed after translation.

    In summary: The far less complicated date/time HTML code block is displayed on both English and French pages. However, the more complicated word cloud HTML code block works on the English page, but is not displayed on the French page (or indeed Spanish), even when the code is exactly the same before translation.

    Why? As far as I know, I should be able to put any code on any page, irrespective of language, even different code on different language pages, and it should work (as it does with the date/time code block).

    Thanks for any light you can throw on this.

    Best regards,
    Keith

    #1397640

    Hi,
    Thanks for your feedback as I understand your goal, the Word Cloud script in the code block contains javascript and base64 code to create the Word Cloud, I believe that you are hoping that the WPML Translation can change the text in the script to different languages, but instead it seems to be breaking the javascript, please note that on your French the code block script has been broken with extra tags. When translating the “text” in a javascript code you need to be careful to not change the “variables” or “functions” which use words also but it’s not the same, so for an automatic program to search javascript code and recognize only “text” when translating whould be very difficult, it’s not the same a translating a article.
    I see your point about the less complicated date/time code block translating well, but I believe that that points to the complicity of the Word Cloud code and WPML Translation not being able to handle it.
    I recommend trying to recreate the Word Cloud script in your three languages at your external service and then manually add the scripts to your pages in the code block after they have been created.

    Best regards,
    Mike

    #1397645

    Hi Mike,
    Thanks for getting back to me, especially on a Sunday!
    I must have introduced the problem with the French code block script somehow. I have now corrected it, but still it doesn’t display.
    To be clear, I am using WPML for the rest of the page, but I already have three versions of the word cloud (one in English, French and Spanish) from my external provider. I don’t want (or believe I need to) use WPML to translate the text in the script as I have the script with that text in French and Spanish already.
    The code block script now on the French page is the French version of the word cloud – I have just manually added it, replacing what was there from the English page.
    Same for the Spanish page: I have pasted the Spanish version of the word cloud into the code block.
    But the code for the French and Spanish word clouds refuses to display on the French and Spanish pages respectively. All is OK on the English page. And if I use script for another language on the English page, the word cloud is fine (e.g. English page with French word cloud: see the English page now).
    The French and Spanish word cloud code does work: if I double-click the html file for each, it opens in my browser and I see those word clouds without issue. But as soon as I used that code on the French and Spanish pages, no luck.
    And I can use the English script on all three language pages, and it will only display on the English page.
    So why does the code block work on one page (main language) but not on secondary language pages?
    Best regards,
    Keith

    #1397648

    Hi,
    Thanks for the feedback, I tried copying the word cloud code blocks from the three pages to my test site and notice none are in English, all three seem to be the same language, please check your pages.
    Can you try posting the three different code blocks on a test page, or different test pages so I can try them.
    I’m thinking that a solution might be to turn your scripts into shortcodes.

    Best regards,
    Mike

    #1397652

    Hi again Mike,
    I have noticed this too. See my test page (link below). This has all 3 code blocks on the same page – English, Spanish then French. I checked. The code I’ve copied and pasted is correct for these blocks. BUT only the French word cloud is displayed for all three blocks on this page. French was the last code I pasted (but I only pasted it into the LAST code block on the page).
    I didn’t mention this earlier as it was not my specific problem, but it’s probably linked!
    I have included a link to my test page and a link to the three html source code files so you can download the code I have pasted (secure Tresorit link).
    I’ve also include a link to test pages that only show one cloud – so you can see the cloud and the words in it in the relevant language.
    But, as soon as I translate one of these ‘top level’ pages with just the word cloud (translating the special heading and text block elements) and even leaving the word cloud as it was (in English), the cloud disappears (see last link below).

    So frustrating! As it should be easy and works standalone. Look forward to your further input and possible solution with shortcodes (will need some help with that…).

    Best for now,
    Keith

    #1397660

    Hi,
    Thanks, the 3 scripts are using the same div selector and the same variables, so when the javascript ran it filled all 3 divs with the same content, this is why you couldn’t use all 3 on the same page, and is probably related to the issue with the translated pages.
    So I modified the 3 scripts so they could show on the same page, please see your test page linked below.
    So this is a good step forward, I tried applying this to your translated test page but it didn’t work and I seemed to have unlinked them from each other, please check.
    I’m not a WPML expert, but I think that if you could edit these 3 pages independently with the code block the scripts should work.
    I was able to create 3 shortcode functions to show your scripts with the following shortcodes on my test page:
    [wordart_en]
    [wordart_es]
    [wordart_fr]

    Enfold_Support_348.jpeg
    so perhaps this could be another approach.
    Try seeing if you can copy the modified codes from your test page and add them to your test language page and see if that works if you edit the pages individually, if not I can add the shortcodes I created to your child theme functions.php and we can see if that helps.

    Best regards,
    Mike

    #1397664

    Hi Mike,
    Thanks! A good step forward as I can see it works on the test page, I see all three word clouds as I hoped I would.
    But unfortunately, it makes no difference on the test language page. I checked and even copied your updated Spanish script to the Spanish translation of the test-en page. It was still linked (WPML is not easy until you get used to it; I’m still learning).
    I also updated the EN, ES and FR home pages with your updated scripts, but same thing: no word cloud on the translated pages.
    I did edit them ‘independently’ (directly through the WP Pages screen, just switching language at the top to edit the French and Spanish ones). This is my preferred way of using WPML anyway and is how I’ve edited everything else on the FR and ES pages (including the small date/time script). But the translations will always be linked with the EN page somehow through WPML, which might well have something to do with this issue. But then again, the uncomplicated date/time script is fine.
    Don’t know where you’re located, but it’s getting late in Spain, so I may not be around for much longer today.
    Thanks for all your help so far. Really appreciated.
    Best for now,
    Keith

    #1397666

    Hi,
    Thanks for the feedback, I added the 3 shortcode functions to your child theme functions.php and created a new test page linked below, please check and see if you can add the shortcodes to your language pages.

    Best regards,
    Mike

    #1397668

    Hi Mike,
    Success!
    The shortcodes work perfectly, see the 3 pages linked below. (I will remove the date/time scripts tomorrow.)
    Thank you so much for your help! I know it’s been a less-than-easy problem and was beyond my skills.
    All the best,
    Keith

    #1397669

    Hi,
    Glad to hear this helped, unless there is anything else we can assist with on this issue, shall we close this then?

    Best regards,
    Mike

    #1397670

    Yes, that’s fine, please close.
    Thanks again.
    Best,
    Keith

    #1397673

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Code block element removing HTML tags on update page’ is closed to new replies.