Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1492347

    Hi all,

    We have been using Enfold with Polylang for around a year. It has worked well to translate pages from English into German and then Spanish. However it has recently been causing issues whereby the frontend layout was broken. After some investigation, it seems that during the translation process, code is inserted ‘custom_class=’ or even ‘custom_class’ in the section and column elements. This therefore stops the execution of the page rendering and requires a manual cleanup of layout elements. I note that if an element has already been assigned an ID or class, this doesn’t happen.

    I have tried the following to filter the outputs, but that hasn’t worked.

    Any ideas of what else I can look into, or why this might be happening?

    // Prevent Polylang from modifying Enfold shortcodes during duplication
    add_filter(‘pll_copy_post_metas’, ‘preserve_enfold_alb_data’, 10, 3);
    function preserve_enfold_alb_data($metas, $sync, $from) {
    // Remove _aviaLayoutBuilder_active from auto-sync to force manual handling
    $metas = array_diff($metas, array(‘_aviaLayoutBuilder_active’));
    return $metas;
    }

    // Clean up malformed custom_class parameters in shortcodes
    add_filter(‘the_content’, ‘fix_polylang_enfold_shortcodes’, 1);
    function fix_polylang_enfold_shortcodes($content) {
    // Remove empty custom_class parameters from sections and columns
    $content = preg_replace(‘/custom_class=[\'”]{2}/’, ”, $content);
    $content = preg_replace(‘/custom_class=[\'”][\s]*[\'”]/’, ”, $content);
    return $content;
    }

    // Clean up malformed HTML output
    add_filter(‘the_content’, ‘remove_custom_class_id_from_html’, 999);
    function remove_custom_class_id_from_html($content) {
    // Remove id=”custom_class=” (malformed with extra equals)
    $content = preg_replace(‘/\s+id=[“\’]custom_class=[“\’]?/i’, ‘ ‘, $content);

    // Remove id=”custom_class” (literal value only)
    $content = preg_replace(‘/\s+id=[“\’]custom_class[“\’]/i’, ‘ ‘, $content);

    return $content;
    }`

    #1492386

    Hey philipe,

    Thank you for the inquiry.

    The custom_class is a valid element parameter, so you don’t need to remove it. Are you adding custom html or shortcodes to the page? It’s possible that these custom shortcodes or embedded content are causing the issue. If you can create a test page and provide the login details in the private field, we’ll take a closer look.

    Best regards,
    Ismael

    #1492404

    thank you, I have sent details below in private content.

    #1492454

    Hi,

    Thank you for the login info.

    The Appearance > Theme File Editor is not accessible, so we’re not able to check if there are modifications that might be contributing to the issue. Please enable the file editor or post the S/FTP details in the private field so we can check the issue further.

    Best regards,
    Ismael

    #1492457
    This reply has been marked as private.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.