Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1101211

    Hi there!

    Recently I came across a problem with some broken links on an Enfold page. Don’t bothered with it, just inserted the link again, saved the page and all was good again – at least until I’ve edited the page again!

    Just digged into the problem and I’ve found out the following: Whenever you’re inserting some HTML containing an URL in text tab (so NOT the visual tab!), all is good.
    E.g. let’s assume an IFRAME (there you have the src parameter), the content will be displayed correctly in ALB and – after saving the page – on the rendered page itself.

    In the WordPress database, each ‘&’ is stored as the corresponding HTML entity (‘&’). So ‘my_url?par1=val1&par2=val2’ becomes ‘my_url?par1=val1&par2=val2’ in the database. Since this works back and forth, no problem so far.

    Now let’s assume we have a parameter named ‘region’. One would expect something like ‘par1=val1&region=val2’, right?
    BUT INSTEAD I’ve found the following in the WP database: ‘par1=val1®ion=val2’. Quite obvious, that this couldn’t work!
    I guess this has something to do with the trademark entity (‘®’).

    Apparently, many people have the same problem in various environments. Read here: https://stackoverflow.com/questions/15532252/why-is-reg-being-rendered-as-without-the-bounding-semicolon
    Or here: https://wordpress.stackexchange.com/questions/295510/wordpress-turns-html-code-to-html-entities
    Or here: https://github.com/WordPress/gutenberg/issues/5717

    I’m not sure if WordPress itself causes the problem or if it’s caused by the Enfold theme. For now, I leave this issue with you, guys!

    Best regards,
    Juergen

    • This topic was modified 5 years, 5 months ago by JVo.
    #1101354

    Her’s some more vital information for you!

    By using a WP filter (add_filter( ‘the_content’,…) incorporating a str_replace function in the function.php of my child theme, I’ve managed to have a workaround for the rendering of the publicly visible web page.
    In fact, there are TWO bytes need to be replaced: 0xC2 0xAE. The latter one is the trademark sign as expected. Dunno where the first one is coming from!?

    I’ve tried the same for the editor with add_filter( ‘the_editor_content’,…), but without any success!
    The behaviour there is a bit strange: I have the IFRAME code in a text block. When I open the page in ALA, the link is broken (so I don’t see the correct content).
    As soon as I click in the text block to edit the text, the content is rendered correctly in the editor pane, but I don’t see anything in the preview pane on the right.

    I guess you have your own parser to render the contents in ALA. Eventually you can provide some hooks I can use there!?

    Thanks in advance,
    Juergen

    • This reply was modified 5 years, 5 months ago by JVo.
    #1102673

    Hi,

    Thank you for using Enfold.

    Do you have a test page where we can see the issue? We tried it on our end, but we could not reproduce the error.

    <a href="http://www.test.com?location=val1&region=val2">Test</a>
    
    <iframe src="http://localhost/kriesi/enfold/test-2?location=val&region=val2"></iframe> 

    The text and the iframe displayed properly in the text block preview.

    Best regards,
    Ismael

    #1103450

    Dear Ismael,

    very strange!

    For sure I can provide site access, please see the details in the `private section.

    Strangely, one cannot edit the functions.php file of my child theme from the admin panel via “Appearance > Editor”.
    So I have created a custom field named ‘fix_region_param’. In conjunction with a corresponding function, this works as a switch (whether you want to fix the error or not). The function looks like this:

    
    // fix HTML entity conversion error
    function dawn_content_filter( $content ) {
    	global $post;
    
    	$fixIt = get_post_meta($post->ID, 'fix_region_param', 'true');
    	if($fixIt='true')
        		$content = str_replace( 'amazon®ion=', 'amazon&region=', $content );
    
        	return $content;
    }
    add_filter( 'the_content', 'dawn_content_filter', 1 );
    

    By editing the value of ‘fix_region_param’ on the page in question, you can select to fix the misbehaviour or not (true/false).
    Currently the switch is set to ‘true’, so everything works properly. If you set it to false, you can see the erroneous output on the page.
    PLEASE DO NOT FORGET TO SET IT TO TRUE AGAIN!!!

    To reproduce the error in the editor, just do the following:

    • Open the page in the editor
    • Edit any text block and save it (no need to change anything)
    • Update the page

    The iframe in the text block you’ve just edited will still look good. If you scroll down to another text block containing an iframe, you will just see some dummy content in the iframe (content delivered by amzn because of now invalid src link).

    If you edit a text block with such a “broken” iframe, that one will look good again.
    Now update the page again (so it reloads in the editor). Result: the others will be broken now!

    In fact, you have to touch all the text blocks containing iframes before saving the page. That’s the only way to make them all look good when you open the editor next time.

    Best regards and many thanks in advance for your help.

    #1104784

    Hi,

    Thanks for the update.

    I can’t reproduce the issue on my end. The “marketplace=amazon&region” remains as is when I edit the text blocks and update the page.

    Where did you add the snippet? The functions.php file is blank and there is no PHP snippet plugin installed.

    Best regards,
    Ismael

    #1104785

    Hi,

    Strangely, one cannot edit the functions.php file of my child theme from the admin panel via “Appearance > Editor”.

    UPDATE: Please post the FTP details in the private field so that we can edit the file.

    Best regards,
    Ismael

    #1104834

    Hi Ismael,

    please find ftp details in private content.

    Cheers,
    Jürgen

    #1105555

    Hi,

    Sorry for the delay. We are not able to debug the issue because the login token has expired. You can keep the dawn_content_filter for the meantime.

    Best regards,
    Ismael

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