Important notice: we will respond to all open ticket requests up until November the 1st. After this date, we will be unable to process the ticket requests here on Ticksy.

Okay
  Public Ticket #1056382
Original flow: posts not loading bug
Closed

Comments

  •  2
    markosh started the conversation

    Hello all,

    we encountered a bug with the original flow setting when loading the posts of a certain category (header menu click on the category). This occurred after we entered quite a number of posts. The demo doesn't show this but has also only few posts.

    Symptom is that a javascript error would show "html object not found" and no posts would be loaded.

    We found as a cause that there is conversion of html to json in blog-functions.php function flow_elated_get_archive_page_html. Even with the DB connection set to use UTF-8 there seems to be occasional invalid characters possible when creating posts. Hence the call "json_encode($return_obj);" is failing silently and nothing is returned back.

    We added a wrapper and now it works  - just FYI for everyone who runs into the same:

    (a) old code

    echo json_encode($return_obj); exit;

    (b) new code

    $encoded = json_encode($return_obj);
    if (json_last_error() == JSON_ERROR_UTF8) {
           $clean = utf8_converter($return_obj);
           $encoded = json_encode($clean);  
    }
    echo json_encode($encoded); exit;

    function utf8_converter($array)
    {
        array_walk_recursive($array, function(&$item, $key){
            if(!mb_detect_encoding($item, 'utf-8', true)){
                    $item = utf8_encode($item);
            }
        });
        return $array;
    }

  •  1,845
    Elated replied

    Hello,

    Thank you for letting us know. We will use this solution if someone get same issue as you had. 

    Thansk


    The Elated Support Center has been moved to our centralized support platform. 

    Please note that any existing tickets prior to this change will be answered right here on Ticksy, and in due time. 

    If you wish to submit a new support request, for all new inquiries please head on to our Help Center.

    Elated Themes is part of Qode Interactive – the home of 300+ premium WordPress themes.

    Don’t forget to sign up for our newsletter and be the first to find out all the latest news.