Clickable phone number feature sometimes breaks the layout

Home Forums Any Mobile Theme Switcher Clickable phone number feature sometimes breaks the layout

This topic contains 1 reply, has 2 voices, and was last updated by  Dinesh 3 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #2847

    Syahir Hakim

    Hi there,

    I am the lead developer of the mobile theme, Graphene Mobile Neo. We have decided to bundle the free version of your mobile theme switching plugin with the theme due to its robustness and stability. Some of the users of our theme have also purchase the pro version of AMTS for W3TC compatibility.

    Now to the question, some of our users have reported an issue where some HTML codes is appearing in contact form message area when the page is viewed on mobile devices (screenshot: ). After further investigation, we have determined the cause to be the “clickable phone number” feature in AMTS.

    I noticed that you’re using PHP’s DOMDocument class to search for the mobile_tel class. However, when using $doc->saveXML(), sometimes additional document declaration ( <?xml … ) is added into the document, causing the layout to break and codes appearing where they shouldn’t.

    A temporary fix that we’ve provided to our users is to disable this feature by commenting line 76 of any-mobile-theme-switcher-pro.php file:

    // add_filter( ‘the_content’, ‘amtsp_make_phone_clickable’, 20);

    This effectively removes the feature and resolves the issue.

    Obviously the above is a temporary fix, and I am keen to work together with you in finding a permanent solution. As a start, might I suggest the following solutions:

    1. Use preg_replace instead of DOMDocument, or
    2. Remove the nodes containing document declaration in the DOMDocument object prior to calling $doc->saveXML().




    Hi Syahir,

    Thanks so much for reporting this. I did got these issues reported as well. But i never knew what was the cause. Your explanation helped me much. Ya, i think we need to move to preg_replace.

    I will change this things and soon send another update.

    Thanks a lot 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Clickable phone number feature sometimes breaks the layout’ is closed to new replies.